Prechádzať zdrojové kódy

确认关系逻辑修改

linwu 1 rok pred
rodič
commit
ee64ca0d88

+ 35 - 0
app/love/controller/AdminLotteryController.php

@@ -0,0 +1,35 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: Powerless < wzxaini9@gmail.com>
+// +----------------------------------------------------------------------
+
+namespace app\love\controller;
+
+use app\love\model\LotteryPrizeModel;
+use cmf\controller\AdminBaseController;
+
+class AdminLotteryController extends AdminBaseController
+{
+    /**
+     * 列表
+     */
+    public function prize()
+    {
+        $list = LotteryPrizeModel::order('id asc')->paginate(10);
+
+        // 获取分页显示
+        $page = $list->render();
+        $this->assign('list', $list);
+        $this->assign('page', $page);
+
+        // 渲染模板输出
+        return $this->fetch();
+    }
+
+}

+ 10 - 6
app/love/controller/MyController.php

@@ -472,16 +472,20 @@ class MyController extends LoveBaseController
     {
         $id      = $this->request->post('id');
         $user_id = cmf_get_current_user_id();
+        if ($user_id == $id) {
+            $this->error('不可以选择自己!');
+        }
         $user    = UserSelectModel::get(['user_id' => $id, 'uid' => $user_id]);
         $check   = UserSelectLogModel::where('user_id1|user_id2', $id)->find();
         if (!empty($check)) {
             $this->error('对方已被选择!');
         }
-        if (!empty($user)) {
-            $user->is_confirm   = 1;
-            $user->confirm_time = time();
-            $user->save();
+        if (empty($user)) {
+            $this->error('该数据不存在!');
         }
+        $user->is_confirm   = 1;
+        $user->confirm_time = time();
+        $user->save();
 
         //增加互选记录
         $log = ['confirm_time' => time()];
@@ -528,7 +532,7 @@ class MyController extends LoveBaseController
             ]);
         }
 
-        //发送提示
+        /*//发送提示
         $time = time();
         UserMessageModel::create([
             'from_id'     => $user_id,
@@ -543,7 +547,7 @@ class MyController extends LoveBaseController
         $friend->last_msg      = '对方:我已接受你的交往请求,快来一起聊天吧!';
         $friend->last_msg_time = $time;
         $friend->unread_num++;
-        $friend->save();
+        $friend->save();*/
 
         $this->success('操作成功');
     }

+ 23 - 0
app/love/model/LotteryLogModel.php

@@ -0,0 +1,23 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: 老猫 <thinkcmf@126.com>
+// +----------------------------------------------------------------------
+namespace app\love\model;
+
+use think\Model;
+
+class LotteryLogModel extends Model
+{
+
+    public function user()
+    {
+        return $this->hasOne(UserModel::class,'id','user_id');
+    }
+
+}

+ 18 - 0
app/love/model/LotteryPrizeModel.php

@@ -0,0 +1,18 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: 老猫 <thinkcmf@126.com>
+// +----------------------------------------------------------------------
+namespace app\love\model;
+
+use think\Model;
+
+class LotteryPrizeModel extends Model
+{
+
+}

+ 65 - 0
public/themes/admin_simpleboot3/love/admin_lottery/prize.html

@@ -0,0 +1,65 @@
+<include file="public@header"/>
+<style>
+    .lw-block {
+        width:15px;
+        height:15px;
+        border:1px solid;
+    }
+</style>
+</head>
+<body>
+<div class="wrap js-check-wrap">
+    <ul class="nav nav-tabs">
+        <li class="active"><a href="javascript:;">所有奖品</a></li>
+        <li><a href="{:url('AdminLottery/add')}">添加奖品</a></li>
+    </ul>
+    <form class="js-ajax-form" action="" method="post">
+        <table class="table table-hover table-bordered table-list">
+            <thead>
+            <tr>
+                <th width="50">ID</th>
+                <th>奖品名称</th>
+                <th width="160">奖品数量</th>
+                <th width="160">中奖概率</th>
+                <th width="160">主图</th>
+                <th width="160">奖品背景色</th>
+                <th width="160">操作</th>
+            </tr>
+            </thead>
+            <foreach name="list" item="vo">
+                <tr>
+                    <td><b>{$vo.id}</b></td>
+                    <td>{$vo.name}</td>
+                    <td>{$vo.number}</td>
+                    <td>{$vo.odds}</td>
+                    <td>
+                        <notempty name="vo.image">
+                            <a href="javascript:parent.imagePreviewDialog('{:cmf_get_image_preview_url($vo.image)}');">
+                                <i class="fa fa-photo fa-fw"></i>
+                            </a>
+                            <else/>
+                            <i class="fa fa-close fa-fw"></i>
+                        </notempty>
+                    </td>
+                    <td><div class="lw-block" style="background:{$vo.bg};"></div></td>
+                    <td>
+                        <a class="btn btn-xs btn-primary" href="{:url('AdminLottery/edit',array('id'=>$vo['id']))}">{:lang('EDIT')}</a>
+                        <a class="btn btn-xs btn-danger js-ajax-delete"
+                           href="{:url('AdminLottery/delete',array('id'=>$vo['id']))}">删除</a>
+                    </td>
+                </tr>
+            </foreach>
+        </table>
+        <ul class="pagination">{$page|default=''}</ul>
+    </form>
+</div>
+<script src="__STATIC__/js/admin.js"></script>
+<script>
+
+    function reloadPage(win) {
+        win.location.reload();
+    }
+
+</script>
+</body>
+</html>