Toggle navigation
This project
Loading...
Sign in
najixian
/
xt_dc_admin
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Download as
Email Patches
Plain Diff
Browse Files
Commit
3c209a13e73218351116d7bf96227ccea3de99c3
Authored by
u123231312
2018-09-04 10:31:32 +0800
1 parent
00a20cf8
build: skipped
增加代理商、商户菜品配置GIF 视频
Changes
5
Builds
0
Inline
Side-by-side
Showing
5 changed files
with
219 additions
and
3 deletions
application/admin/controller/Auth.php
application/admin/controller/Template.php
application/admin/view/auth/agent_Add.html
application/admin/view/auth/operate_Add.html
application/admin/view/template/config_mer.html
application/admin/controller/Auth.php
View file @
3c209a1
...
...
@@ -341,6 +341,19 @@ class Auth extends Common
$this
->
assign
(
'qrcode_path'
,
$arr
[
'data'
]);
return
view
();
}
//增加代理商人员
public
function
agentAdd
(){
//缓存60秒 不请求。
$arr
=
cache
(
'qrcod_url'
);
if
(
!
$arr
){
$arr
=
file_get_contents
(
"http://xt.colorcun.com/WechatApi/WechatApi/CreateAgentAddQrcode/"
);
$arr
=
json_decode
(
$arr
,
TRUE
);
cache
(
'qrcod_url'
,
$arr
,
50
);
}
$this
->
assign
(
'qrcode_path'
,
$arr
[
'data'
]);
return
view
();
}
//增加运营管理人员
public
function
operateDel
(){
if
(
Request
::
isAjax
()){
...
...
application/admin/controller/Template.php
View file @
3c209a1
...
...
@@ -287,7 +287,7 @@ class Template extends Common{
}
return
$result
;
}
$this
->
assign
(
'title'
,
'商户菜品配置'
);
$this
->
assign
(
'title'
,
'商户菜品配置'
);
return
$this
->
fetch
();
}
...
...
@@ -296,8 +296,8 @@ class Template extends Common{
* 配置商家菜品信息
*/
public
function
configMer
(){
//获取分类
$data
=
Request
::
except
(
'file'
);
//获取运营人员列表
$list
=
file_get_contents
(
'http://www.dc-api.com/public/index.php?service=App.Cookbook.GetCookbookByClass&sellerid='
.
$data
[
'id'
]);
$array
=
json_decode
(
$list
,
TRUE
);
$this
->
assign
(
'data'
,
$data
);
//商户信息
...
...
@@ -305,5 +305,65 @@ class Template extends Common{
$this
->
assign
(
'title'
,
'商户菜品配置'
);
return
$this
->
fetch
();
}
//根据菜品分类ID获取菜品分类下所有菜品
public
function
configClass
(){
$data
=
Request
::
except
(
'file'
);
if
(
Request
::
isAjax
()){
//获取分类下所有菜品
$list
=
file_get_contents
(
'http://www.dc-api.com/public/index.php?service=App.Cookbook.GetCookbookByClassId&ClassId='
.
$data
[
'classid'
]);
$array
=
json_decode
(
$list
,
TRUE
);
return
$array
[
'data'
][
'data'
];
}
return
$this
->
fetch
();
}
//根据菜品名称 模糊匹配 七牛云菜品图片、视频
public
function
configCategoryName
(){
if
(
Request
::
isAjax
()){
$data
=
Request
::
except
(
'file'
);
//查询是否存在该名字
$where
=
'(name like "%'
.
$data
[
'categoryName'
]
.
'%") OR (pic like "%'
.
$data
[
'categoryName'
]
.
'%")'
;
//$scList=db('cookbook_material')->where('name|pic','like',$data['categoryName'],'OR')->select();
$scList
=
db
(
'cookbook_material'
)
->
where
(
$where
)
->
select
();
//dump( Db::getLastSql()); //sql调试
foreach
(
$scList
as
$key
=>
$value
)
{
$picType
=
pathinfo
(
$value
[
'pic'
],
PATHINFO_EXTENSION
);
//识别文件类型
if
(
$picType
==
"png"
||
$picType
==
"gif"
)
$scList
[
$key
][
'type'
]
=
"png"
;
else
if
(
$picType
==
"mp4"
)
$scList
[
$key
][
'type'
]
=
"mp4"
;
}
if
(
!
empty
(
$scList
)){
$result
[
'code'
]
=
1
;
$result
[
'msg'
]
=
"success"
;
$result
[
'data'
]
=
$scList
;
}
else
{
$result
[
'code'
]
=
0
;
$result
[
'msg'
]
=
"未找到合适的数据"
;
$result
[
'data'
]
=
$scList
;
}
return
$result
;
}
}
//根据菜品ID 菜品GIF、视频配置
public
function
updateCookBook
(){
if
(
Request
::
isAjax
()){
$data
=
Request
::
except
(
'file'
);
//接口调起
$list
=
file_get_contents
(
'http://www.dc-api.com/public/index.php?service=App.Cookbook.SetCookbookById&sellerid='
.
$data
[
'sellerid'
]
.
'&id='
.
$data
[
'dishname'
]
.
'&dishesVideo='
.
$data
[
'dishesVideo'
]
.
'&dishesGif='
.
$data
[
'dishesGif'
]);
$array
=
json_decode
(
$list
,
TRUE
);
if
(
$array
[
'data'
][
'data'
]
==
1
){
$result
[
'code'
]
=
1
;
$result
[
'msg'
]
=
"配置成功!"
;
}
else
{
$result
[
'code'
]
=
0
;
$result
[
'msg'
]
=
"配置失败!"
.
$array
[
'msg'
];
}
return
$result
;
}
}
}
\ No newline at end of file
...
...
application/admin/view/auth/agent_Add.html
0 → 100644
View file @
3c209a1
{include file="common/head"/}
<div
class=
"admin-main fadeInUp animated"
ng-app=
"hd"
ng-controller=
"ctrl"
>
<fieldset
class=
"layui-elem-field layui-field-title"
>
<legend>
请扫描二维码完成添加代理商操作
</legend>
</fieldset>
<form
class=
"layui-form layui-form-pane"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
style=
"height: 465px;width: 500px;"
><img
style=
"margin: 20px;height: 400px;width: 400px;"
src=
"{$qrcode_path}"
/></label>
</div>
<div
class=
"layui-form-item"
>
<div
class=
"layui-input-block"
>
<a
href=
"{:url('operateList')}"
style=
"margin-left: 95px"
class=
"layui-btn"
>
{:lang('back')}
</a>
</div>
</div>
</form>
</div>
{include file="common/foot"/}
\ No newline at end of file
...
...
application/admin/view/auth/operate_Add.html
View file @
3c209a1
{include file="common/head"/}
<div
class=
"admin-main fadeInUp animated"
ng-app=
"hd"
ng-controller=
"ctrl"
>
<fieldset
class=
"layui-elem-field layui-field-title"
>
<legend>
请扫描二维码完成操作
</legend>
<legend>
请扫描二维码完成
添加小饕运营人员
操作
</legend>
</fieldset>
<form
class=
"layui-form layui-form-pane"
>
<div
class=
"layui-form-item"
>
...
...
application/admin/view/template/config_mer.html
0 → 100644
View file @
3c209a1
{include file="common/head"/}
<div
class=
"admin-main layui-anim layui-anim-upbit"
>
<fieldset
class=
"layui-elem-field layui-field-title"
>
<legend>
{$title}
</legend>
</fieldset>
<form
class=
"layui-form layui-form-pane"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
商家名字
</label>
<div
class=
"layui-input-4"
>
<input
type=
"text"
value=
"{:$data['name']}"
disabled
class=
"layui-input"
>
<input
type=
"hidden"
name=
"sellerid"
value=
"{:$data['id']}"
class=
"layui-input"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
菜品分类
</label>
<div
class=
"layui-input-block"
>
<div
class=
"layui-input-4"
>
<select
name=
"class"
id=
"class"
lay-filter=
"myselect"
>
<option
value=
""
>
请选择类别
</option>
{foreach $list as $vo}
<option
value=
"{$vo.id}"
>
{$vo.class_name}
</option>
{/foreach}
</select>
</div>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
菜品名称
</label>
<div
class=
"layui-input-block"
>
<div
class=
"layui-input-4"
>
<select
name=
"dishname"
id=
"dishname"
lay-filter=
"myselect1"
>
<option
value=
""
>
请选择菜品
</option>
</select>
</div>
</div>
</div>
<div
style=
"overflow: hidden;border: 1px solid #ccc;"
id=
"picVideo"
>
<span
class=
"layui-form-label"
>
视频
</span>
</div>
<div
style=
"overflow: hidden;border: 1px solid #ccc;"
id=
"picImg"
>
<span
class=
"layui-form-label"
>
GIF图片
</span>
</div>
<div
class=
"layui-form-item"
>
<div
class=
"layui-input-block"
>
<button
type=
"button"
class=
"layui-btn"
lay-submit=
""
lay-filter=
"submit"
>
{:lang('submit')}
</button>
<a
href=
"{:url('sellerList')}"
class=
"layui-btn layui-btn-primary"
>
{:lang('back')}
</a>
</div>
</div>
</form>
</div>
{include file="common/foot"/}
<script>
layui
.
use
(
'form'
,
function
()
{
var
form
=
layui
.
form
,
$
=
layui
.
jquery
;
//根据分类ID查分类下所有菜品
form
.
on
(
'select(myselect)'
,
function
(
data
){
var
classid
=
(
data
.
value
);
//layui 获取下拉框选中的值
$
.
ajax
({
type
:
'POST'
,
url
:
'/admin/template/configClass'
,
data
:
{
classid
:
classid
},
dataType
:
'json'
,
success
:
function
(
data
){
$
(
"#dishname"
).
html
(
""
);
$
.
each
(
data
,
function
(
key
,
val
)
{
var
option1
=
$
(
"<option>"
).
val
(
val
.
id
).
text
(
val
.
name
);
$
(
"#dishname"
).
append
(
option1
);
form
.
render
(
'select'
);
});
$
(
"#dishname"
).
get
(
0
).
selectedIndex
=
0
;
}
});
});
//根据菜品名称模糊匹配七牛菜品信息
form
.
on
(
'select(myselect1)'
,
function
(
data
){
var
categoryName
=
data
.
elem
[
data
.
elem
.
selectedIndex
].
text
;
//layui 获取下拉框选中的文本
$
.
ajax
({
type
:
'POST'
,
url
:
'/admin/template/configCategoryName'
,
data
:
{
categoryName
:
categoryName
},
dataType
:
'json'
,
success
:
function
(
data
){
if
(
data
.
code
==
1
){
$
.
each
(
data
.
data
,
function
(
key
,
val
)
{
if
(
val
.
type
==
"png"
){
var
str
=
'<img class="layui-upload-img" id="adPic" src="http://'
+
val
.
pic
+
'">'
+
'<div class="layui-input-block"><input type="radio" name="dishesGif" value="'
+
val
.
pic
+
'" title="'
+
val
.
name
+
'"></div>'
;
$
(
"#picImg"
).
append
(
str
);
form
.
render
();
}
else
{
var
str
=
'<video id="adVideo" autoplay="autoplay" controls="controls" src ="http://'
+
val
.
pic
+
'" style="width: 260px;height: 200px;display: block;"></video>'
+
'<div class="layui-input-block"><input type="radio" name="dishesVideo" value="'
+
val
.
pic
+
'" title="'
+
val
.
name
+
'"></div>'
;
$
(
"#picVideo"
).
append
(
str
);
form
.
render
();
}
});
}
else
{
layer
.
msg
(
data
.
msg
,
{
time
:
1000
,
icon
:
2
});
}
}
});
});
//根据菜品ID 修改对应菜品的GIF、视频url
form
.
on
(
'submit(submit)'
,
function
(
data
)
{
var
loading
=
layer
.
load
(
1
,
{
shade
:
[
0.1
,
'#fff'
]});
$
.
post
(
"{:url('updateCookBook')}"
,
data
.
field
,
function
(
res
)
{
layer
.
close
(
loading
);
if
(
res
.
code
==
1
)
{
layer
.
msg
(
res
.
msg
,
{
time
:
1000
,
icon
:
1
},
function
()
{
location
.
href
=
"{:url('sellerList')}"
;
});
}
else
{
layer
.
msg
(
res
.
msg
,
{
time
:
1000
,
icon
:
2
});
}
});
})
});
</script>
\ No newline at end of file
...
...
Please
register
or
login
to post a comment