diff --git a/app/data/controller/Config.php b/app/data/controller/Config.php index e0b11b9ff..8f4b20151 100644 --- a/app/data/controller/Config.php +++ b/app/data/controller/Config.php @@ -2,7 +2,6 @@ namespace app\data\controller; -use app\data\service\MessageService; use think\admin\Controller; /** @@ -26,23 +25,6 @@ class Config extends Controller $this->__sysconf('wxapp'); } - /** - * 短信接口配置 - * @auth true - * @menu true - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - */ - public function message() - { - if ($this->request->isGet()) { - $this->title = '短信接口配置'; - $this->result = MessageService::instance()->balance(); - } - $this->__sysconf('message'); - } - /** * 关于我们描述 * @auth true diff --git a/app/data/controller/NewsItem.php b/app/data/controller/NewsItem.php index 520ee785f..e417875c7 100644 --- a/app/data/controller/NewsItem.php +++ b/app/data/controller/NewsItem.php @@ -97,8 +97,9 @@ class NewsItem extends Controller $data['code'] = CodeExtend::uniqidNumber(14, 'A'); } if ($this->request->isGet()) { - $query = $this->app->db->name('DataNewsMark')->where(['deleted' => 0, 'status' => 1]); - $this->mark = $query->order('sort desc,id desc')->select()->toArray(); + $map = ['deleted' => 0, 'status' => 1]; + $query = $this->app->db->name('DataNewsMark')->where($map); + $this->marks = $query->order('sort desc,id desc')->select()->toArray(); $data['mark'] = str2arr($data['mark'] ?? ''); } else { $data['mark'] = arr2str($data['mark'] ?? []); diff --git a/app/data/controller/NewsMark.php b/app/data/controller/NewsMark.php index 617696890..aa2f174fb 100644 --- a/app/data/controller/NewsMark.php +++ b/app/data/controller/NewsMark.php @@ -20,7 +20,6 @@ class NewsMark extends Controller /** * 文章标签管理 * @auth true - * @menu true * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException diff --git a/app/data/controller/Payment.php b/app/data/controller/Payment.php index e4992e797..38455fd0a 100644 --- a/app/data/controller/Payment.php +++ b/app/data/controller/Payment.php @@ -80,18 +80,15 @@ class Payment extends Controller if ($this->request->isGet()) { $this->payments = []; foreach ($this->types as $k => $vo) { - [$allow, $group] = [[], ucfirst(strstr($k, '_', true))]; + $allow = []; foreach ($vo['bind'] as $api) if (isset(UserService::TYPES[$api])) { $allow[$api] = UserService::TYPES[$api]['name']; } - $vo['allow'] = join('、', $allow); - $this->payments[$group][$k] = $vo; + $this->payments[$k] = array_merge($vo, ['allow' => join('、', $allow)]); } $data['content'] = json_decode($data['content'] ?? '[]', true) ?: []; } else { - if (empty($data['type'])) { - $this->error('请选择支付通道并配置支付参数!'); - } + if (empty($data['type'])) $this->error('请选择支付通道并配置支付参数!'); $data['content'] = json_encode($this->request->post() ?: [], JSON_UNESCAPED_UNICODE); } } diff --git a/app/data/controller/ShopGoodsMark.php b/app/data/controller/ShopGoodsMark.php index 8c7428686..176458331 100644 --- a/app/data/controller/ShopGoodsMark.php +++ b/app/data/controller/ShopGoodsMark.php @@ -20,7 +20,6 @@ class ShopGoodsMark extends Controller /** * 商品标签管理 * @auth true - * @menu true * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException @@ -28,7 +27,9 @@ class ShopGoodsMark extends Controller public function index() { $this->title = '商品标签管理'; - $this->_query($this->table)->order('sort desc,id desc')->page(); + $query = $this->_query($this->table); + $query->like('name')->dateBetween('create_at'); + $query->equal('status')->order('sort desc,id desc')->page(); } /** diff --git a/app/data/controller/UserMessage.php b/app/data/controller/UserMessage.php index 8cd41368a..a5e43ee03 100644 --- a/app/data/controller/UserMessage.php +++ b/app/data/controller/UserMessage.php @@ -2,6 +2,7 @@ namespace app\data\controller; +use app\data\service\MessageService; use think\admin\Controller; /** @@ -33,6 +34,27 @@ class UserMessage extends Controller $query->dateBetween('create_at')->order('id desc')->page(); } + /** + * 短信接口配置 + * @auth true + * @menu true + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public function config() + { + if ($this->request->isGet()) { + $this->title = '短信接口配置'; + $this->result = MessageService::instance()->balance(); + $this->fetch(); + } else { + $data = $this->request->post(); + foreach ($data as $k => $v) sysconf($k, $v); + $this->success('配置保存成功!'); + } + } + /** * 删除短信记录 * @auth true diff --git a/app/data/controller/api/Wechat.php b/app/data/controller/api/Wechat.php index 4b65fe499..65ad7125b 100644 --- a/app/data/controller/api/Wechat.php +++ b/app/data/controller/api/Wechat.php @@ -13,7 +13,8 @@ use think\Response; * @package app\data\controller\api * @example 域名请修改为自己的地址,放到网页代码合适位置 * - * + * + * * 授权模式支持两种模块,参数 mode=0 时为静默授权,mode=1 时为完整授权 * 注意:回跳地址默认从 Header 中的 http_referer 获取,也可以传 source 参数 */ @@ -32,45 +33,22 @@ class Wechat extends Controller */ private $field; - /** - * 粉丝OPNEID - * @var string - */ - private $openid; - - /** - * 网页授权配置 - * @var array - */ - private $config; - - /** - * 微信粉丝数据 - * @var array - */ - private $fansInfo; - - /** - * 前端用户数据 - * @var array - */ - private $userInfo; - /** * 控制器初始化 + * @return $this */ - protected function initialize() + protected function initialize(): Wechat { if (empty(UserService::TYPES[$this->type]['auth'])) { $this->error("接口类型[{$this->type}]没有定义规则"); } else { $this->field = UserService::TYPES[$this->type]['auth']; } + return $this; } /** - * 加载对应JSSDK数据 - * @return \think\Response + * 获取 JSSDK 签名 * @throws \WeChat\Exceptions\InvalidResponseException * @throws \WeChat\Exceptions\LocalCacheException * @throws \think\Exception @@ -78,79 +56,39 @@ class Wechat extends Controller * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ - public function jssdk(): Response + public function jssdk() { - $wechat = WechatService::instance(); - $source = $this->request->server('http_referer', $this->request->get('source', '')); + $url = input('source') ?: $this->request->server('http_referer'); + $this->success('获取签名参数', WechatService::instance()->getWebJssdkSign($url)); + } + + /** + * 加载网页授权数据 + * @return \think\Response + * @throws \think\Exception + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public function oauth(): Response + { + [$script, $wechat] = [[], WechatService::instance()]; + $source = input('source') ?: $this->request->server('http_referer'); $result = $wechat->getWebOauthInfo($source ?: $this->request->url(true), input('mode', 1), false); if (empty($result['openid'])) { - $content = 'alert("Wechat WebOauth failed.")'; + $script[] = 'alert("Wechat WebOauth failed.")'; } else { - $this->openid = $result['openid']; - $this->fansInfo = $result['fansinfo'] ?? []; - $this->config = $wechat->getWebJssdkSign($source); - // 用户注册并登录生成接口令牌 - $data = $this->fansInfo; + $data = $result['fansinfo'] ?? []; $data['openid2'] = $data['openid']; $data['base_sex'] = ['未知', '男', '女'][$data['sex']] ?? '未知'; if (isset($data['headimgurl'])) $data['headimg'] = $data['headimgurl']; - $map = isset($data['unionid']) ? ['unionid' => $data['unionid']] : [$this->field => $this->openid]; - $this->userInfo = UserService::instance()->set($map, array_merge($map, $data), $this->type, true); - $content = $this->_buildContent(); + $map = isset($data['unionid']) ? ['unionid' => $data['unionid']] : [$this->field => $result['openid']]; + $result['userinfo'] = UserService::instance()->set($map, array_merge($map, $data), $this->type, true); + $script[] = "window.WeChatOpenid='{$result['openid']}'"; + $script[] = 'window.WeChatFansInfo=' . json_encode($result['fansinfo'], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); + $script[] = 'window.WeChatUserInfo=' . json_encode($result['userinfo'], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); } - return Response::create($content)->contentType('application/x-javascript'); + $script[] = ''; + return Response::create(join(";\n", $script))->contentType('application/x-javascript'); } - - - /** - * 页面授权 jssdk 测试 - * @return string - */ - public function jssdkTest(): string - { - $src = sysuri('data/api.wechat/jssdk', [], false, true) . '?mode=1'; - return << -
- 页面授权测试 - - -
- - - - -EOL; - } - - /** - * 生成JOSN数据 - * @param mixed $data - * @return false|string - */ - private function _jsonEncode($data) - { - return json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); - } - - /** - * 生成授权内容 - * @return string - */ - private function _buildContent(): string - { - return <<_jsonEncode($this->config)}); - wx.fansinfo={$this->_jsonEncode($this->fansInfo)}; - wx.userinfo={$this->_jsonEncode($this->userInfo)}; - wx.ready(function(){ - wx.hideOptionMenu(); - wx.hideAllNonBaseMenuItem(); - }); -} -EOF; - } - } \ No newline at end of file diff --git a/app/data/controller/api/auth/Center.php b/app/data/controller/api/auth/Center.php index 5690a5aa3..0052301cf 100644 --- a/app/data/controller/api/auth/Center.php +++ b/app/data/controller/api/auth/Center.php @@ -117,15 +117,16 @@ class Center extends Auth { $data = $this->_vali(['from.require' => '邀请人不能为空']); if ($data['from'] == $this->uuid) { - $this->error('邀请人不能是自己哦', UserService::instance()->total($this->uuid)); + $this->error('邀请人不能是自己', UserService::instance()->total($this->uuid)); } $from = $this->app->db->name($this->table)->where(['id' => $data['from']])->find(); if (empty($from)) $this->error('邀请人状态异常', UserService::instance()->get($this->type, $this->uuid)); - if ($this->user['from'] > 0) $this->error('您已经绑定了邀请人', UserService::instance()->total($this->uuid)); + if ($this->user['from'] > 0) $this->error('已绑定了邀请人', UserService::instance()->total($this->uuid)); + $data['path'] = rtrim($from['path'] ?: '-', '-') . '-' . $from['id'] . '-'; if ($this->app->db->name($this->table)->where(['id' => $this->uuid])->update($data) !== false) { - $this->success('绑定邀请人成功!', UserService::instance()->total($this->uuid)); + $this->success('绑定邀请人成功', UserService::instance()->total($this->uuid)); } else { - $this->error('绑定邀请人失败!', UserService::instance()->total($this->uuid)); + $this->error('绑定邀请人失败', UserService::instance()->total($this->uuid)); } } diff --git a/app/data/view/config/content.html b/app/data/view/config/content.html index 44d7961ff..d5c5f87ef 100644 --- a/app/data/view/config/content.html +++ b/app/data/view/config/content.html @@ -2,9 +2,6 @@ {block name="content"}
-

- 演示接口文档:http://www.docway.net/project/1WkI0ZyQ7M1/share/1Wld0z7b1zE -

diff --git a/app/data/view/news_item/form.html b/app/data/view/news_item/form.html index 59ad92f54..8f8d52c28 100644 --- a/app/data/view/news_item/form.html +++ b/app/data/view/news_item/form.html @@ -7,7 +7,7 @@ 文章标签 Mark Name
- {foreach $mark as $tag}{if isset($vo.mark) && is_array($vo.mark) && in_array($tag.name, $vo.mark)} + {foreach $marks as $tag}{if isset($vo.mark) && is_array($vo.mark) && in_array($tag.name, $vo.mark)} {else} diff --git a/app/data/view/news_item/index.html b/app/data/view/news_item/index.html index 48499fd56..3dd8c398d 100644 --- a/app/data/view/news_item/index.html +++ b/app/data/view/news_item/index.html @@ -1,8 +1,12 @@ {extend name="../../admin/view/main"} {block name="button"} + + + + - + @@ -12,9 +16,6 @@ {block name='content'}
-

- 演示接口文档:http://www.docway.net/project/1WkI0ZyQ7M1/share/1Wld0z7b1zE -

{include file='news_item/index_search'} {notempty name='list'} diff --git a/app/data/view/news_mark/form.html b/app/data/view/news_mark/form.html index 43af590bf..605bd56d6 100644 --- a/app/data/view/news_mark/form.html +++ b/app/data/view/news_mark/form.html @@ -4,7 +4,7 @@ 标签名称Mark Name - 必填,请填写分类名称(如:系统管理),建议字符不要太长,一般4-6个汉字 + 必填,请填写标签名称,建议字符不要太长,一般4-6个汉字
diff --git a/app/data/view/news_mark/index.html b/app/data/view/news_mark/index.html index ef279db96..25b74a7da 100644 --- a/app/data/view/news_mark/index.html +++ b/app/data/view/news_mark/index.html @@ -1,20 +1,7 @@ -{extend name="../../admin/view/main"} - -{block name="button"} - - - - - - - -{/block} +{extend name="../../admin/view/full"} {block name='content'} -
-

- 演示接口文档:http://www.docway.net/project/1WkI0ZyQ7M1/share/1Wld0z7b1zE -

+
{include file='news_mark/index_search'}
{notempty name='list'} @@ -47,7 +34,7 @@
{$vo.create_at|format_datetime} {if auth("edit")} - 编 辑 + 编 辑 {/if} {if auth("state") and $vo.status eq 1} 禁 用 @@ -64,5 +51,10 @@
{empty name='list'}没有记录哦{else}{$pagehtml|raw|default=''}{/empty} +
+ + + +
{/block} \ No newline at end of file diff --git a/app/data/view/news_mark/index_search.html b/app/data/view/news_mark/index_search.html index 6624355a3..137a3321f 100644 --- a/app/data/view/news_mark/index_search.html +++ b/app/data/view/news_mark/index_search.html @@ -12,7 +12,8 @@
- - {foreach $payments as $kk => $vv} - - {foreach $vv as $k => $v}{if $vo.type eq $k} - - {else} - - {/if}{/foreach} - - {/foreach} + {foreach $payments as $k=>$v}{if isset($vo.type) and $vo.type eq $k} + + {else} + + {/if}{/foreach}
@@ -60,8 +54,10 @@ {block name='script'} {/block} \ No newline at end of file diff --git a/app/data/view/payment/index.html b/app/data/view/payment/index.html index 3bafb06c6..80ecf87ef 100644 --- a/app/data/view/payment/index.html +++ b/app/data/view/payment/index.html @@ -12,9 +12,6 @@ {block name='content'}
-

- 演示接口文档:http://www.docway.net/project/1WkI0ZyQ7M1/share/1Wld0z7b1zE -

{include file='payment/index_search'} {notempty name='list'} diff --git a/app/data/view/shop_goods/form.html b/app/data/view/shop_goods/form.html index 83a538db9..3bf6e629f 100644 --- a/app/data/view/shop_goods/form.html +++ b/app/data/view/shop_goods/form.html @@ -4,6 +4,7 @@ {include file='shop_goods/formstyle'}
+ {notempty name='marks'}
商品标签 Mark Name @@ -15,6 +16,9 @@ {/if}{/foreach}
+ {/notempty} + + {notempty name='cates'} + {/notempty} + + +
商品图片及轮播展示图片
@@ -64,6 +72,7 @@
+
商品规格及商品SKU绑定(规格填写后不允许再次修改) + +
商品富文本详情
+
+ {notempty name='vo.code'}{/notempty} +
- {notempty name='vo.code'}{/notempty}
diff --git a/app/data/view/shop_goods/index.html b/app/data/view/shop_goods/index.html index 004d979c3..2a130eb26 100644 --- a/app/data/view/shop_goods/index.html +++ b/app/data/view/shop_goods/index.html @@ -1,6 +1,10 @@ {extend name="../../admin/view/main"} {block name="button"} + + + + @@ -37,8 +41,8 @@ - 商品名称 - 商品标签 + 商品信息 + @@ -69,18 +73,22 @@ 销售状态:{eq name='vo.status' value='0'}已下架{else}销售中{/eq}
+ 所属分类:{$vo.cate.name|default='-'}
+
剩余库存 {$vo.stock_total-$vo.stock_sales} 件 ( 已销售 {$vo.stock_sales} 件 )
- {if auth('copy')} + 复 制 - {/if} + + 编 辑 编 辑 + {if isset($type) and $type eq 'index'} {if isset($vo.status) and $vo.status eq 1} diff --git a/app/data/view/shop_goods/index_search.html b/app/data/view/shop_goods/index_search.html index 7891161e9..f05517e84 100644 --- a/app/data/view/shop_goods/index_search.html +++ b/app/data/view/shop_goods/index_search.html @@ -7,12 +7,15 @@
+
+ + {notempty name='marks'}
+ {/notempty} + + {notempty name='clist'}
+ {/notempty} +
+
+ +
+ + +
+ +
+ + +
+
+ +
+ + diff --git a/app/data/view/shop_goods_mark/form.html b/app/data/view/shop_goods_mark/form.html index 4b9d5b8ff..605bd56d6 100644 --- a/app/data/view/shop_goods_mark/form.html +++ b/app/data/view/shop_goods_mark/form.html @@ -3,19 +3,22 @@ +
标签描述 Mark Remark
+
{notempty name='vo.id'}{/notempty} +
diff --git a/app/data/view/shop_goods_mark/index.html b/app/data/view/shop_goods_mark/index.html index f92a414cc..d6637d05b 100644 --- a/app/data/view/shop_goods_mark/index.html +++ b/app/data/view/shop_goods_mark/index.html @@ -1,16 +1,8 @@ -{extend name="../../admin/view/main"} - -{block name="button"} - - - - - - -{/block} +{extend name="../../admin/view/full"} {block name='content'} -
+
+ {include file='shop_goods_mark/index_search'} {notempty name='list'} @@ -43,7 +35,7 @@
- 编 辑 + 编 辑 @@ -64,5 +56,11 @@
{empty name='list'}没有记录哦{else}{$pagehtml|raw|default=''}{/empty} + +
+ + + +
{/block} \ No newline at end of file diff --git a/app/data/view/shop_goods_mark/index_search.html b/app/data/view/shop_goods_mark/index_search.html new file mode 100644 index 000000000..137a3321f --- /dev/null +++ b/app/data/view/shop_goods_mark/index_search.html @@ -0,0 +1,39 @@ +
+ 条件搜索 + +
+ + diff --git a/app/data/view/config/message.html b/app/data/view/user_message/config.html similarity index 100% rename from app/data/view/config/message.html rename to app/data/view/user_message/config.html diff --git a/app/data/view/user_message/index.html b/app/data/view/user_message/index.html index b61d429b5..900258aad 100644 --- a/app/data/view/user_message/index.html +++ b/app/data/view/user_message/index.html @@ -14,9 +14,7 @@ - + 目标手机 短信内容 @@ -30,9 +28,7 @@ {foreach $list as $key=>$vo} - + {$vo.phone|default=''} {$vo.content|default=''} diff --git a/app/data/view/user_message/index_search.html b/app/data/view/user_message/index_search.html index 55be76b83..e01d54554 100644 --- a/app/data/view/user_message/index_search.html +++ b/app/data/view/user_message/index_search.html @@ -1,18 +1,20 @@
条件搜索 -