Просмотр исходного кода

更新config、group_data、管理通知列表、砍价原价显示错误

sugar1569 7 лет назад
Родитель
Сommit
877438e0cb

Разница между файлами не показана из-за своего большого размера
+ 1 - 1
application/admin/controller/setting/SystemConfig.php


+ 2 - 2
application/admin/controller/setting/SystemGroupData.php

@@ -52,7 +52,7 @@ class SystemGroupData extends AuthController
                 $params = explode("\n",$value["param"]);
                 if(is_array($params) && !empty($params)){
                     foreach ($params as $index => $v) {
-                        $vl = explode('=',$v);
+                        $vl = explode('=>',$v);
                         if(!empty($vl[0]) && !empty($vl[1])){
                             $info[$index]["value"] = $vl[0];
                             $info[$index]["label"] = $vl[1];
@@ -154,7 +154,7 @@ class SystemGroupData extends AuthController
                 $params = explode("\n",$value["param"]);
                 if(is_array($params) && !empty($params)){
                     foreach ($params as $index => $v) {
-                        $vl = explode('=',$v);
+                        $vl = explode('=>',$v);
                         if(!empty($vl[0]) && !empty($vl[1])){
                             $info[$index]["value"] = $vl[0];
                             $info[$index]["label"] = $vl[1];

+ 4 - 1
application/admin/controller/ump/StoreSeckill.php

@@ -65,6 +65,9 @@ class StoreSeckill extends AuthController
         return Json::successlayui(['count'=>$seckillList['list']['total'],'data'=>$data]);
     }
 
+    public function get_seckill_id(){
+        return Json::successlayui(StoreSeckillModel::getSeckillIdAll());
+    }
     /**
      * 添加秒杀产品
      * @return form-builder
@@ -221,7 +224,7 @@ class StoreSeckill extends AuthController
         $f[] = Form::frameImageOne('image','产品主图片(305*305px)',Url::build('admin/widget.images/index',array('fodder'=>'image')),$product->getData('image'))->icon('image');
         $f[] = Form::frameImages('images','产品轮播图(640*640px)',Url::build('admin/widget.images/index',array('fodder'=>'images')),json_decode($product->getData('images')))->maxLength(5)->icon('images');
         $f[] = Form::number('price','秒杀价',$product->getData('price'))->min(0)->col(12);
-        $f[] = Form::number('ot_price','原价',$product->getData('price'))->min(0)->col(12);
+        $f[] = Form::number('ot_price','原价',$product->getData('ot_price'))->min(0)->col(12);
         $f[] = Form::number('cost','成本价',$product->getData('cost'))->min(0)->col(12);
         $f[] = Form::number('stock','库存',$product->getData('stock'))->min(0)->precision(0)->col(12);
         $f[] = Form::number('sales','销量',$product->getData('sales'))->min(0)->precision(0)->col(12);

+ 1 - 3
application/admin/model/order/StoreOrder.php

@@ -116,10 +116,8 @@ class StoreOrder extends ModelBasic
             }else if($item['paid']==1 && $item['status']==1 && $item['refund_status']==0){
                 $item['status_name']='待收货';
             }else if($item['paid']==1 && $item['status']==2 && $item['refund_status']==0){
-                $item['status_name']='已收货';
-            }else if($item['paid']==1 && $item['status']==3 && $item['refund_status']==0){
                 $item['status_name']='待评价';
-            }else if($item['paid']==1 && $item['status']==4 && $item['refund_status']==0){
+            }else if($item['paid']==1 && $item['status']==3 && $item['refund_status']==0){
                 $item['status_name']='已完成';
             }else if($item['paid']==1 && $item['refund_status']==1){
                 $item['status_name']=<<<HTML

Разница между файлами не показана из-за своего большого размера
+ 1 - 1
application/admin/model/system/SystemConfig.php


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
application/admin/model/system/SystemConfigTab.php


+ 122 - 86
application/admin/view/user/user_notice/index.php

@@ -1,101 +1,137 @@
 {extend name="public/container"}
 {block name="content"}
-<div class="row">
-    <div class="col-sm-12">
-        <div class="ibox">
-            <div class="ibox-title">
-                <button type="button" class="btn btn-w-m btn-primary" onclick="$eb.createModalFrame(this.innerText,'{:Url('create')}')">添加通知</button>
-            </div>
-            <div class="ibox-content">
-                <div class="table-responsive">
-                    <table class="table table-striped  table-bordered">
-                        <thead>
-                        <tr>
-                            <th class="text-center">编号</th>
-                            <th class="text-center">发送人</th>
-                            <th class="text-center">通知标题</th>
-                            <th class="text-center" width="700">通知内容</th>
-                            <th class="text-center">消息类型</th>
-                            <th class="text-center">是否发送</th>
-                            <th class="text-center">操作</th>
-                        </tr>
-                        </thead>
-                        <tbody class="">
-                        {volist name="list" id="vo"}
-                        <tr>
-                            <td class="text-center">{$vo.id}</td>
-                            <td class="text-center">{$vo.user}</td>
-                            <td class="text-center">{$vo.title}</td>
-                            <td class="text-center">{$vo.content}</td>
-                            <td class="text-center">
-                                {if condition="$vo['type'] eq 1"}
-                                    系统消息
-                                {elseif condition="$vo['type'] eq 2" /}
-                                    用户通知
-                                {/if}
-                            </td>
-                            <td class="text-center">
-                                {if condition="$vo['is_send'] eq 1"}
-                                    状态:<span style="color:green;">已发送</span><br />
-                                    时间:{$vo.send_time|date='Y-m-d H:i:s',###}
-                                {else /}
-                                    状态:<span style="color:red;">未发送</span> <a class="btn-send" data-url="{:Url('send',array('id'=>$vo['id']))}">立即发送</a>
-                                {/if}
-                            </td>
-                            <td class="text-center">
-                                <button class="btn btn-info btn-xs" type="button"  onclick="window.location.href='{:Url('user',array('id'=>$vo['id']))}'"><i class="fa fa-user"></i> 用户信息</button>
-                                {if condition="$vo['is_send'] eq 0"}
-                                    <button class="btn btn-info btn-xs" type="button"  onclick="$eb.createModalFrame('编辑','{:Url('edit',array('id'=>$vo['id']))}')"><i class="fa fa-paste"></i> 编辑</button>
-                                {/if}
-                                <button class="btn btn-warning btn-xs" data-url="{:Url('delete',array('id'=>$vo['id']))}" type="button"><i class="fa fa-warning"></i> 删除</button>
-                            </td>
-                        </tr>
-                        {/volist}
-                        </tbody>
-                    </table>
+<div class="layui-fluid">
+    <div class="layui-row layui-col-space15"  id="app">
+        <div class="layui-col-md12">
+            <div class="layui-card">
+                <div class="layui-card-header">通知列表</div>
+                <div class="layui-card-body">
+                    <div class="layui-btn-container">
+                        <button class="layui-btn layui-btn-sm" onclick="$eb.createModalFrame(this.innerText,'{:Url('create')}')">添加通知</button>
+                    </div>
+                    <table class="layui-hide" id="List" lay-filter="List"></table>
+                    <!--消息状态-->
+                    <script type="text/html" id="type">
+                        {{# if(d.type==1){ }}
+                            <p>系统消息</p>
+                        {{# }else if(d.type==2){ }}
+                            <p>用户通知</p>
+                        {{# } }}
+                    </script>
+                    <!--消息状态-->
+                    <script type="text/html" id="is_send">
+                        {{# if(d.is_send==1){ }}
+                        状态:<span style="color:green;">已发送</span><br />
+                        时间:{{d.send_time}}
+                        {{# }else{ }}
+                        状态:<span style="color:red;">未发送</span> <a class="layui-btn layui-btn-xs layui-btn-normal" lay-event='send'>立即发送</a>
+                        {{# } }}
+                    </script>
+                    <script type="text/html" id="act">
+                        <button type="button" class="layui-btn layui-btn-xs" onclick="dropdown(this)">操作 <span class="caret"></span></button>
+                        <ul class="layui-nav-child layui-anim layui-anim-upbit">
+                            <li>
+                                <a href="javascript:;"  onclick="window.location.href='{:Url('user')}?id={{d.id}}'"><i class="fa fa-user"></i> 用户信息</a>
+                            </li>
+                            {{# if(d.is_send==0){ }}
+                            <li>
+                                <a href="javascript:;"  onclick="$eb.createModalFrame('编辑','{:Url('edit')}?id={{d.id}}')"><i class="fa fa-paste"></i> 编辑</a>
+                            </li>
+                            {{# } }}
+                            <li>
+                                <a href="javascript:;" lay-event='warning'><i class="fa fa-warning"></i> 删除</a>
+                            </li>
+                        </ul>
+                    </script>
                 </div>
-                {include file="public/inner_page"}
             </div>
         </div>
     </div>
 </div>
+<script src="{__ADMIN_PATH}js/layuiList.js"></script>
 {/block}
 {block name="script"}
 <script>
-    $('.btn-warning').on('click',function(){
-        window.t = $(this);
-        var _this = $(this),url =_this.data('url');
-        $eb.$swal('delete',function(){
-            $eb.axios.get(url).then(function(res){
-                if(res.status == 200 && res.data.code == 200) {
-                    $eb.$swal('success',res.data.msg);
-                    _this.parents('tr').remove();
-                }else
-                    return Promise.reject(res.data.msg || '删除失败')
-            }).catch(function(err){
-                $eb.$swal('error',err);
-            });
-        })
+    layList.tableList('List',"{:Url('index')}",function (){
+        return [
+            {field: 'id', title: '编号', sort: true,event:'id'},
+            {field: 'user', title: '发送人'},
+            {field: 'title', title: '通知标题'},
+            {field: 'content', title: '通知内容'},
+            {field: 'type', title: '消息类型',templet:'#type'},
+            {field: 'is_send', title: '是否发送',templet:'#is_send'},
+            {field: 'right', title: '操作',align:'center',toolbar:'#act',width:'10%'},
+        ];
     });
-    $('.btn-send').on('click',function(){
-        var _this = $(this),url =_this.data('url');
-        $eb.$swal('delete',function(){
-            $eb.axios.get(url).then(function(res){
-                if(res.status == 200 && res.data.code == 200) {
-                    $eb.$swal('success',res.data.msg);
-                    window.location.reload();
-                }else
-                    return Promise.reject(res.data.msg || '发送失败')
-            }).catch(function(err){
-                $eb.$swal('error',err);
-            });
-        },{
-            title:"您确定要发送这条信息吗",
-            text:"发送后将无法修改通知信息,请谨慎操作!",
-            confirm:"是的,我要发送!",
-            cancel:"让我再考虑一下"
+    //下拉框
+    $(document).click(function (e) {
+        $('.layui-nav-child').hide();
+    })
+    function dropdown(that){
+        var oEvent = arguments.callee.caller.arguments[0] || event;
+        oEvent.stopPropagation();
+        var offset = $(that).offset();
+        var top=offset.top-$(window).scrollTop();
+        var index = $(that).parents('tr').data('index');
+        $('.layui-nav-child').each(function (key) {
+            if (key != index) {
+                $(this).hide();
+            }
         })
-    });
+        if($(document).height() < top+$(that).next('ul').height()){
+            $(that).next('ul').css({
+                'padding': 10,
+                'top': - ($(that).parents('td').height() / 2 + $(that).height() + $(that).next('ul').height()/2),
+                'min-width': 'inherit',
+                'position': 'absolute'
+            }).toggle();
+        }else{
+            $(that).next('ul').css({
+                'padding': 10,
+                'top':$(that).parents('td').height() / 2 + $(that).height(),
+                'min-width': 'inherit',
+                'position': 'absolute'
+            }).toggle();
+        }
+    }
+    layList.tool(function (event,data,obj) {
+        switch (event) {
+            case 'send':
+                var url =layList.U({c:'user.user_notice',a:'send',p:{id:data.id}});
+                $eb.$swal('delete',function(){
+                    $eb.axios.get(url).then(function(res){
+                        if(res.status == 200 && res.data.code == 200) {
+                            $eb.$swal('success',res.data.msg);
+                            obj.update({is_send:1,send_time:'{:date("Y-m-d H:i:s",time())}'});
+                        }else
+                            return Promise.reject(res.data.msg || '发送失败')
+                    }).catch(function(err){
+                        $eb.$swal('error',err);
+                    });
+                },{
+                    title:"您确定要发送这条信息吗",
+                    text:"发送后将无法修改通知信息,请谨慎操作!",
+                    confirm:"是的,我要发送!",
+                    cancel:"让我再考虑一下"
+                })
+                break;
+            case 'warning':
+                window.t = $(this);
+                var _this = $(this),url =layList.U({a:'delete',p:{id:data.id}});
+                $eb.$swal('delete',function(){
+                    $eb.axios.get(url).then(function(res){
+                        if(res.status == 200 && res.data.code == 200) {
+                            $eb.$swal('success',res.data.msg);
+                            _this.parents('tr').remove();
+                        }else
+                            return Promise.reject(res.data.msg || '删除失败')
+                    }).catch(function(err){
+                        $eb.$swal('error',err);
+                    });
+                })
+                break;
+        }
+    })
     $('.head_image').on('click',function (e) {
         var image = $(this).data('image');
         $eb.openImage(image);

+ 6 - 1
application/routine/model/user/RoutineUser.php

@@ -41,7 +41,12 @@ class RoutineUser extends ModelBasic
         }else if(WechatUser::be(['routine_openid'=>$routineInfo['routine_openid']])){ //根据小程序openid判断
             WechatUser::edit($routineInfo,$routineInfo['routine_openid'],'routine_openid');
             $uid = WechatUser::where('routine_openid',$routineInfo['routine_openid'])->value('uid');
-            User::updateWechatUser($routineInfo,$uid);
+            if(!User::be(['uid'=>$uid])){
+                $routineInfo = WechatUser::where('uid',$uid)->find();
+                User::setRoutineUser($routineInfo);
+            }else{
+                User::updateWechatUser($routineInfo,$uid);
+            }
         }else{
             $routineInfo['add_time'] = time();//用户添加时间
             $routineInfo = WechatUser::set($routineInfo);

+ 10 - 1
extend/behavior/wechat/UserBehavior.php

@@ -21,7 +21,16 @@ class UserBehavior
     public static function wechatOauthAfter($openid,$wechatInfo)
     {
         Cookie::set('is_login',1);
-        if(WechatUser::be(['openid'=>$wechatInfo['openid']])){
+        if($wechatInfo['unionid'] != '' && WechatUser::be(['unionid'=>$wechatInfo['unionid']])){
+            WechatUser::edit($wechatInfo,$wechatInfo['unionid'],'unionid');
+            $uid = WechatUser::where('unionid',$wechatInfo['unionid'])->value('uid');
+            if(!User::be(['uid'=>$uid])){
+                $wechatInfo = WechatUser::where('uid',$uid)->find();
+                User::setWechatUser($wechatInfo);
+            }else{
+                User::updateWechatUser($wechatInfo,$uid);
+            }
+        }else if(WechatUser::be(['openid'=>$wechatInfo['openid']])){
             WechatUser::edit($wechatInfo,$wechatInfo['openid'],'openid');
             User::updateWechatUser($wechatInfo,WechatUser::openidToUid($wechatInfo['openid']));
         }else{

+ 3 - 3
extend/service/WechatTemplateService.php

@@ -53,10 +53,10 @@ class WechatTemplateService
 
     public static function sendTemplate($openid,$templateId,array $data,$url = null,$defaultColor = '')
     {
-        $templateinfo = WechatTemplateModel::where('tempkey',$templateId)->where('status',1)->find();
-        if(!$templateinfo) return false;
+        $tempid = WechatTemplateModel::where('tempkey',$templateId)->where('status',1)->value('tempid');
+        if(!$tempid) return false;
         try{
-            return WechatService::sendTemplate($openid,$templateinfo['tempid'],$data,$url,$defaultColor);
+            return WechatService::sendTemplate($openid,$tempid,$data,$url,$defaultColor);
         }catch (\Exception $e){
             return false;
         }