hrjy 2 years ago
parent
commit
c39cfef363
100 changed files with 2328 additions and 286 deletions
  1. 272 0
      app/admin/controller/luck/LuckDraw.php
  2. 267 0
      app/admin/controller/luck/LuckOrder.php
  3. 10 1
      app/admin/controller/many/Many.php
  4. 3 5
      app/admin/controller/setting/SystemConfig.php
  5. 4 2
      app/admin/controller/store/StoreProduct.php
  6. 6 0
      app/admin/controller/user/User.php
  7. 0 7
      app/admin/controller/wechat/index.php
  8. 57 0
      app/admin/model/luck/LuckDraw.php
  9. 58 0
      app/admin/model/luck/LuckOrder.php
  10. 1 1
      app/admin/model/user/UserExtract.php
  11. 1 1
      app/admin/view/login/index.php
  12. 192 0
      app/admin/view/luck/luck_draw/index.php
  13. 189 0
      app/admin/view/luck/luck_order/index.php
  14. 2 2
      app/admin/view/many/many/index.php
  15. 1 0
      app/admin/view/order/store_order/index.php
  16. 17 16
      app/admin/view/store/store_product/create.php
  17. 26 27
      app/admin/view/user/user/index.php
  18. 6 2
      app/api/controller/AuthController.php
  19. 188 0
      app/api/controller/luck/LuckController.php
  20. 16 13
      app/api/controller/many/ManyController.php
  21. 4 3
      app/api/controller/order/StoreOrderController.php
  22. 80 3
      app/api/controller/user/UserController.php
  23. 2 0
      app/api/controller/user/UserExtractController.php
  24. 19 1
      app/common.php
  25. 37 29
      app/http/middleware/AllowOriginMiddleware.php
  26. 5 5
      app/models/many/Many.php
  27. 125 109
      app/models/many/ManyOrder.php
  28. 67 48
      app/models/store/StoreOrder.php
  29. 6 0
      app/models/user/UserBill.php
  30. 2 1
      app/models/user/UserExtract.php
  31. 1 1
      app/register/view/index/down.html
  32. 3 3
      app/register/view/index/index.html
  33. 1 1
      config/app.php
  34. 4 4
      crmeb/repositories/OrderRepository.php
  35. 1 1
      crmeb/repositories/PaymentRepositories.php
  36. 8 0
      crmeb/subscribes/TaskSubscribe.php
  37. 2 0
      public/index/index.html
  38. 556 0
      public/index/static/css/cmy.css
  39. 53 0
      public/index/static/css/flex.css
  40. 36 0
      public/index/static/css/padding.css
  41. BIN
      public/index/static/error/emptyCart.png
  42. BIN
      public/index/static/error/errorImage.jpg
  43. BIN
      public/index/static/error/missing-face.png
  44. BIN
      public/index/static/game/game1.png
  45. BIN
      public/index/static/game/game10.png
  46. BIN
      public/index/static/game/game11.png
  47. BIN
      public/index/static/game/game2.png
  48. BIN
      public/index/static/game/game21.png
  49. BIN
      public/index/static/game/game22.png
  50. BIN
      public/index/static/game/game23.png
  51. BIN
      public/index/static/game/game24.png
  52. BIN
      public/index/static/game/game3.png
  53. BIN
      public/index/static/game/game4.png
  54. BIN
      public/index/static/game/game6.png
  55. BIN
      public/index/static/game/game7.png
  56. BIN
      public/index/static/game/game8.png
  57. BIN
      public/index/static/icon/add.png
  58. BIN
      public/index/static/icon/call.png
  59. BIN
      public/index/static/icon/dh.png
  60. BIN
      public/index/static/icon/dsjh.png
  61. BIN
      public/index/static/icon/fanhui.png
  62. BIN
      public/index/static/icon/i1.png
  63. BIN
      public/index/static/icon/i2.png
  64. BIN
      public/index/static/icon/i3.png
  65. BIN
      public/index/static/icon/i4.png
  66. BIN
      public/index/static/icon/img01.png
  67. BIN
      public/index/static/icon/img03.png
  68. BIN
      public/index/static/icon/img04.png
  69. BIN
      public/index/static/icon/img05.png
  70. BIN
      public/index/static/icon/reduce.png
  71. BIN
      public/index/static/img/add.png
  72. BIN
      public/index/static/img/bottom.png
  73. BIN
      public/index/static/img/call.94b30316.png
  74. BIN
      public/index/static/img/cash-bg.8993f7b8.png
  75. BIN
      public/index/static/img/cash-bg.png
  76. BIN
      public/index/static/img/delete.png
  77. BIN
      public/index/static/img/deletes.png
  78. BIN
      public/index/static/img/detailImg.2548823d.jpg
  79. BIN
      public/index/static/img/detailImg.jpg
  80. BIN
      public/index/static/img/dh.35663c8e.png
  81. BIN
      public/index/static/img/game1.7ca1e6cf.png
  82. BIN
      public/index/static/img/game10.1ba44d51.png
  83. BIN
      public/index/static/img/game11.4e9d7a5b.png
  84. BIN
      public/index/static/img/game2.beba2f35.png
  85. BIN
      public/index/static/img/game3.bad6d0b3.png
  86. BIN
      public/index/static/img/game4.542414b4.png
  87. BIN
      public/index/static/img/game6.aba1cb44.png
  88. BIN
      public/index/static/img/game8.4dd27a77.png
  89. BIN
      public/index/static/img/img009.609fc055.png
  90. BIN
      public/index/static/img/img009.png
  91. BIN
      public/index/static/img/img01.png
  92. BIN
      public/index/static/img/img010.becc4342.png
  93. BIN
      public/index/static/img/img010.png
  94. BIN
      public/index/static/img/img03.png
  95. BIN
      public/index/static/img/img04.png
  96. BIN
      public/index/static/img/img05.png
  97. BIN
      public/index/static/img/index01.png
  98. BIN
      public/index/static/img/index02.cc385428.png
  99. BIN
      public/index/static/img/index02.png
  100. BIN
      public/index/static/img/index03.223e9175.png

+ 272 - 0
app/admin/controller/luck/LuckDraw.php

@@ -0,0 +1,272 @@
+<?php
+/**
+ *
+ * @author: xaboy<365615158@qq.com>
+ * @day: 2017/11/11
+ */
+
+namespace app\admin\controller\luck;
+
+use app\admin\controller\AuthController;
+use crmeb\repositories\OrderRepository;
+use crmeb\repositories\ShortLetterRepositories;
+use crmeb\services\{ExpressService,
+    JsonService,
+    JsonService as Json,
+    MiniProgramService,
+    WechatService,
+    FormBuilder as Form,
+    CacheService,
+    UtilService as Util};
+use app\admin\model\ump\StorePink;
+use crmeb\basic\BaseModel;
+use think\facade\Route as Url;
+use crmeb\services\YLYService;
+use think\facade\Log;
+use think\facade\Validate;
+
+/**
+ * 订单管理控制器 同一个订单表放在一个控制器
+ * Class StoreOrder
+ * @package app\admin\controller\store
+ */
+class LuckDraw extends AuthController
+{
+    /**
+     * @return mixed
+     */
+    public function index()
+    {
+
+        return $this->fetch();
+    }
+
+
+    public function list()
+    {
+        $where = Util::getMore([
+            ['status', ''],
+            ['page', 1],
+            ['limit', 20],
+            ['name', '']
+        ]);
+
+        return Json::successlayui(\app\admin\model\luck\LuckDraw::list($where));
+    }
+
+    /**
+     * 显示创建资源表单页.
+     *
+     * @return \think\Response
+     */
+    public function create($id = 0)
+    {
+        $f = [];
+        $f[] = Form::input('name', '名称')->col(12);
+//        $f[] = Form::frameImageOne('image', '封面图(305*305px)', Url::buildUrl('admin/widget.images/index', array('fodder' => 'image')))->icon('image')->width('100%')->height('500px');
+        $f[] = Form::input('money', '额度');
+        $f[] = Form::input('increase', '自动增长额度', 0);
+        $f[] = Form::input('second', '自动增长时间(秒)', 0);
+        $f[] = Form::input('upper_limit', '参与上限');
+        $f[] = Form::input('single', '单次上限');
+        $f[] = Form::input('lower_limit', '单次下限');
+        $f[] = Form::dateTime('add_time', '开启时间');
+        $f[] = Form::dateTime('end_time', '结束时间');
+        $f[] = Form::input('sort', '排序',0);
+        if ($id) $f[] = Form::hidden('id', $id);
+        $form = Form::make_post_form('添加', $f, Url::buildUrl('save'));
+        $this->assign(compact('form'));
+        return $this->fetch('public/form-builder');
+
+
+    }
+
+    public function save()
+    {
+        $model = new \app\admin\model\many\Many();
+        $data = Util::postMore([
+            'name',
+//            'image',
+            'money',
+            'upper_limit',
+            'add_time',
+            'end_time',
+            'sort',
+            'increase',
+            'second',
+            'single',
+            'lower_limit'
+        ]);
+        $validate = Validate::rule('name', 'require')->rule([
+            'name' => 'require',
+//            'image' => 'require',
+            'money' => 'require',
+            'upper_limit' => 'require',
+            'add_time' => 'require',
+            'end_time' => 'require',
+            'single' => 'require',
+            'lower_limit' => 'require',
+        ]);
+        $validate->message([
+            'name.require' => '名称不能为空',
+//            'image.require' => '图片不能为空',
+            'money.require' => '额度不能为空',
+            'upper_limit.require' => '上限不能为空',
+            'add_time.require' => '请选择进场时间',
+            'end_time.require' => '请选择结束时间',
+            'single.require' => '请填写单次上限',
+            'lower_limit.require' => '请填写单次下限',
+        ]);
+        if (!$validate->check($data)) {
+            return Json::fail($validate->getError());
+        }
+        $data['add_time'] = strtotime($data['add_time']);
+        $data['end_time'] = strtotime($data['end_time']);
+        $res = $model->save($data);
+        if ($res) return Json::successful('添加成功');
+        return Json::fail('添加失败');
+    }
+
+
+    /**
+     * 显示创建资源表单页.
+     *
+     * @return \think\Response
+     */
+    public function edit($id = 0)
+    {
+        $data = \app\admin\model\luck\LuckDraw::find($id);
+        $f = [];
+        $f[] = Form::input('title', '名称',$data->getData('title'))->col(12);
+//        $f[] = Form::frameImageOne('image', '封面图(305*305px)', Url::buildUrl('admin/widget.images/index', array('fodder' => 'image')), $data->getData('image'))->icon('image')->width('100%')->height('500px');
+        $f[] = Form::input('count', '数量', $data->getData('count'));
+        $f[] = Form::input('price', '价格', $data->getData('price'));
+        $f[] = Form::input('probability', '概率', $data->getData('probability'));
+        $f[] = Form::hidden('id', $id);
+        $form = Form::make_post_form('修改', $f, Url::buildUrl('update'));
+        $this->assign(compact('form'));
+        return $this->fetch('public/form-builder');
+    }
+
+
+    /**
+     * 修改
+     * @return void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
+    public function update()
+    {
+        $model = new \app\admin\model\luck\LuckDraw();
+        $data = Util::postMore([
+            'id',
+            'title',
+//            'image',
+            'count',
+            'price',
+            'probability',
+        ]);
+        $validate = Validate::rule([
+            'title' => 'require',
+//            'image' => 'require',
+            'count' => 'require',
+            'price' => 'require',
+            'probability' => 'require',
+        ]);
+        $validate->message([
+            'title.require' => '名称不能为空',
+//            'image.require' => '图片不能为空',
+            'count.require' => '数量不能为空',
+            'price.require' => '价格不能为空',
+            'probability.require' => '请填写概率',
+        ]);
+        if (!$validate->check($data)) {
+            return Json::fail($validate->getError());
+        }
+        $details = $model->find($data['id']);
+        $details['title'] = $data['title'];
+        $details['count'] = $data['count'];
+        $details['price'] = $data['price'];
+        $details['probability'] = $data['probability'];
+        $res = $details->save();
+        if ($res) return Json::successful('修改成功');
+        return Json::fail('修改失败');
+    }
+
+    /**
+     * 显示创建资源表单页.
+     *
+     * @return \think\Response
+     */
+    public function next($id = 0)
+    {
+        $f = [];
+        $f[] = Form::dateTime('add_time', '开启时间');
+        $f[] = Form::dateTime('end_time', '结束时间');
+        $f[] = Form::hidden('id', $id);
+        $form = Form::make_post_form('添加', $f, Url::buildUrl('next_save'));
+        $this->assign(compact('form'));
+        return $this->fetch('public/form-builder');
+    }
+
+    public function next_save()
+    {
+        $model = new \app\admin\model\many\Many();
+        $data = Util::postMore([
+            'id',
+            'add_time',
+            'end_time',
+        ]);
+        $validate = Validate::rule([
+            'add_time' => 'require',
+            'end_time' => 'require',
+        ]);
+        $validate->message([
+            'add_time.require' => '请选择开启时间',
+            'end_time.require' => '请选择结束时间',
+        ]);
+        if (!$validate->check($data)) {
+            return Json::fail($validate->getError());
+        }
+        $details = $model->find($data['id']);
+        if ($details['status'] == 1) return Json::fail('未结束不能进行下一场');
+        if ($details['suc'] == 2) return Json::fail('已众筹失败无法就行下一场');
+        if (strtotime($data['end_time']) < strtotime($data['add_time'])) return Json::fail('结束时间不能小于开启时间');
+        $details['stage'] += 1;
+        $details['status'] = 1;
+        $details['number'] = 0;//重置额度
+        $details['money'] = intval($details['money'] * 1.3);//提搞额度130%
+        $details['suc'] = 0;
+        $details['add_time'] = strtotime($data['add_time']);
+        $details['end_time'] = strtotime($data['end_time']);
+        $res = $details->save();
+        if ($res) return Json::successful('成功');
+        return Json::fail('失败');
+
+
+    }
+
+
+
+    /**
+     * 删除
+     * @param $id
+     * @return void
+     * @throws \Exception
+     */
+    public function delete($id)
+    {
+        if (!$id) Json::fail('删除失败');
+        $model = new \app\admin\model\many\Many();
+
+        $res = \app\admin\model\many\Many::destroy($id);
+        if ($res){
+            return Json::success('删除成功!');
+        }else{
+            return Json::fail($model->getErrorInfo());
+        }
+
+    }
+
+}

+ 267 - 0
app/admin/controller/luck/LuckOrder.php

@@ -0,0 +1,267 @@
+<?php
+/**
+ *
+ * @author: xaboy<365615158@qq.com>
+ * @day: 2017/11/11
+ */
+
+namespace app\admin\controller\luck;
+
+use app\admin\controller\AuthController;
+use crmeb\repositories\OrderRepository;
+use crmeb\repositories\ShortLetterRepositories;
+use crmeb\services\{ExpressService,
+    JsonService,
+    JsonService as Json,
+    MiniProgramService,
+    WechatService,
+    FormBuilder as Form,
+    CacheService,
+    UtilService as Util};
+use app\admin\model\ump\StorePink;
+use crmeb\basic\BaseModel;
+use think\facade\Route as Url;
+use crmeb\services\YLYService;
+use think\facade\Log;
+use think\facade\Validate;
+
+/**
+ * 订单管理控制器 同一个订单表放在一个控制器
+ * Class StoreOrder
+ * @package app\admin\controller\store
+ */
+class LuckOrder extends AuthController
+{
+    /**
+     * @return mixed
+     */
+    public function index()
+    {
+
+        return $this->fetch();
+    }
+
+
+    public function list()
+    {
+        $where = Util::getMore([
+            ['status', ''],
+            ['page', 1],
+            ['limit', 20],
+            ['name', '']
+        ]);
+
+        return Json::successlayui(\app\admin\model\luck\LuckOrder::list($where));
+    }
+
+    /**
+     * 显示创建资源表单页.
+     *
+     * @return \think\Response
+     */
+    public function create($id = 0)
+    {
+        $f = [];
+        $f[] = Form::input('name', '名称')->col(12);
+//        $f[] = Form::frameImageOne('image', '封面图(305*305px)', Url::buildUrl('admin/widget.images/index', array('fodder' => 'image')))->icon('image')->width('100%')->height('500px');
+        $f[] = Form::input('money', '额度');
+        $f[] = Form::input('increase', '自动增长额度', 0);
+        $f[] = Form::input('second', '自动增长时间(秒)', 0);
+        $f[] = Form::input('upper_limit', '参与上限');
+        $f[] = Form::input('single', '单次上限');
+        $f[] = Form::input('lower_limit', '单次下限');
+        $f[] = Form::dateTime('add_time', '开启时间');
+        $f[] = Form::dateTime('end_time', '结束时间');
+        $f[] = Form::input('sort', '排序',0);
+        if ($id) $f[] = Form::hidden('id', $id);
+        $form = Form::make_post_form('添加', $f, Url::buildUrl('save'));
+        $this->assign(compact('form'));
+        return $this->fetch('public/form-builder');
+
+
+    }
+
+    public function save()
+    {
+        $model = new \app\admin\model\many\Many();
+        $data = Util::postMore([
+            'name',
+//            'image',
+            'money',
+            'upper_limit',
+            'add_time',
+            'end_time',
+            'sort',
+            'increase',
+            'second',
+            'single',
+            'lower_limit'
+        ]);
+        $validate = Validate::rule('name', 'require')->rule([
+            'name' => 'require',
+//            'image' => 'require',
+            'money' => 'require',
+            'upper_limit' => 'require',
+            'add_time' => 'require',
+            'end_time' => 'require',
+            'single' => 'require',
+            'lower_limit' => 'require',
+        ]);
+        $validate->message([
+            'name.require' => '名称不能为空',
+//            'image.require' => '图片不能为空',
+            'money.require' => '额度不能为空',
+            'upper_limit.require' => '上限不能为空',
+            'add_time.require' => '请选择进场时间',
+            'end_time.require' => '请选择结束时间',
+            'single.require' => '请填写单次上限',
+            'lower_limit.require' => '请填写单次下限',
+        ]);
+        if (!$validate->check($data)) {
+            return Json::fail($validate->getError());
+        }
+        $data['add_time'] = strtotime($data['add_time']);
+        $data['end_time'] = strtotime($data['end_time']);
+        $res = $model->save($data);
+        if ($res) return Json::successful('添加成功');
+        return Json::fail('添加失败');
+    }
+
+
+    /**
+     * 显示创建资源表单页.
+     *
+     * @return \think\Response
+     */
+    public function edit($id = 0)
+    {
+        $data = \app\admin\model\luck\LuckDraw::find($id);
+        $f = [];
+        $f[] = Form::input('title', '名称',$data->getData('title'))->col(12);
+//        $f[] = Form::frameImageOne('image', '封面图(305*305px)', Url::buildUrl('admin/widget.images/index', array('fodder' => 'image')), $data->getData('image'))->icon('image')->width('100%')->height('500px');
+        $f[] = Form::input('count', '数量', $data->getData('count'));
+        $f[] = Form::input('price', '价格', $data->getData('price'));
+        $f[] = Form::hidden('id', $id);
+        $form = Form::make_post_form('修改', $f, Url::buildUrl('update'));
+        $this->assign(compact('form'));
+        return $this->fetch('public/form-builder');
+    }
+
+
+    /**
+     * 修改
+     * @return void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
+    public function update()
+    {
+        $model = new \app\admin\model\luck\LuckDraw();
+        $data = Util::postMore([
+            'id',
+            'title',
+//            'image',
+            'count',
+            'price',
+        ]);
+        $validate = Validate::rule([
+            'title' => 'require',
+//            'image' => 'require',
+            'count' => 'require',
+            'price' => 'require',
+        ]);
+        $validate->message([
+            'title.require' => '名称不能为空',
+//            'image.require' => '图片不能为空',
+            'count.require' => '数量不能为空',
+            'price.require' => '价格不能为空',
+        ]);
+        if (!$validate->check($data)) {
+            return Json::fail($validate->getError());
+        }
+        $details = $model->find($data['id']);
+        $details['title'] = $data['title'];
+        $details['count'] = $data['count'];
+        $details['price'] = $data['price'];
+        $res = $details->save();
+        if ($res) return Json::successful('修改成功');
+        return Json::fail('修改失败');
+    }
+
+    /**
+     * 显示创建资源表单页.
+     *
+     * @return \think\Response
+     */
+    public function next($id = 0)
+    {
+        $f = [];
+        $f[] = Form::dateTime('add_time', '开启时间');
+        $f[] = Form::dateTime('end_time', '结束时间');
+        $f[] = Form::hidden('id', $id);
+        $form = Form::make_post_form('添加', $f, Url::buildUrl('next_save'));
+        $this->assign(compact('form'));
+        return $this->fetch('public/form-builder');
+    }
+
+    public function next_save()
+    {
+        $model = new \app\admin\model\many\Many();
+        $data = Util::postMore([
+            'id',
+            'add_time',
+            'end_time',
+        ]);
+        $validate = Validate::rule([
+            'add_time' => 'require',
+            'end_time' => 'require',
+        ]);
+        $validate->message([
+            'add_time.require' => '请选择开启时间',
+            'end_time.require' => '请选择结束时间',
+        ]);
+        if (!$validate->check($data)) {
+            return Json::fail($validate->getError());
+        }
+        $details = $model->find($data['id']);
+        if ($details['status'] == 1) return Json::fail('未结束不能进行下一场');
+        if ($details['suc'] == 2) return Json::fail('已众筹失败无法就行下一场');
+        if (strtotime($data['end_time']) < strtotime($data['add_time'])) return Json::fail('结束时间不能小于开启时间');
+        $details['stage'] += 1;
+        $details['status'] = 1;
+        $details['number'] = 0;//重置额度
+        $details['money'] = intval($details['money'] * 1.3);//提搞额度130%
+        $details['suc'] = 0;
+        $details['add_time'] = strtotime($data['add_time']);
+        $details['end_time'] = strtotime($data['end_time']);
+        $res = $details->save();
+        if ($res) return Json::successful('成功');
+        return Json::fail('失败');
+
+
+    }
+
+
+
+    /**
+     * 删除
+     * @param $id
+     * @return void
+     * @throws \Exception
+     */
+    public function delete($id)
+    {
+        if (!$id) Json::fail('删除失败');
+        $model = new \app\admin\model\luck\LuckOrder();
+
+        $res = \app\admin\model\luck\LuckOrder::destroy($id);
+        if ($res){
+            return Json::success('删除成功!');
+        }else{
+            return Json::fail($model->getErrorInfo());
+        }
+
+    }
+
+}

+ 10 - 1
app/admin/controller/many/Many.php

@@ -69,6 +69,7 @@ class Many extends AuthController
         $f[] = Form::input('second', '自动增长时间(秒)', 0);
         $f[] = Form::input('upper_limit', '参与上限');
         $f[] = Form::input('single', '单次上限');
+        $f[] = Form::input('lower_limit', '单次下限');
         $f[] = Form::dateTime('add_time', '开启时间');
         $f[] = Form::dateTime('end_time', '结束时间');
         $f[] = Form::input('sort', '排序',0);
@@ -94,6 +95,7 @@ class Many extends AuthController
             'increase',
             'second',
             'single',
+            'lower_limit'
         ]);
         $validate = Validate::rule('name', 'require')->rule([
             'name' => 'require',
@@ -103,6 +105,7 @@ class Many extends AuthController
             'add_time' => 'require',
             'end_time' => 'require',
             'single' => 'require',
+            'lower_limit' => 'require',
         ]);
         $validate->message([
             'name.require' => '名称不能为空',
@@ -112,6 +115,7 @@ class Many extends AuthController
             'add_time.require' => '请选择进场时间',
             'end_time.require' => '请选择结束时间',
             'single.require' => '请填写单次上限',
+            'lower_limit.require' => '请填写单次下限',
         ]);
         if (!$validate->check($data)) {
             return Json::fail($validate->getError());
@@ -140,6 +144,7 @@ class Many extends AuthController
         $f[] = Form::input('second', '自动增长时间(秒)', $data->getData('second'));
         $f[] = Form::input('upper_limit', '参与上限',  $data->getData('upper_limit'));
         $f[] = Form::input('single', '单次上限',  $data->getData('single'));
+        $f[] = Form::input('lower_limit', '单次下限',  $data->getData('lower_limit'));
         $f[] = Form::dateTime('add_time', '开启时间', date('Y-m-d H:i:s', $data->getData('add_time')));
         $f[] = Form::dateTime('end_time', '结束时间', date('Y-m-d H:i:s', $data->getData('end_time')));
         $f[] = Form::input('sort', '排序',$data->getData('sort'));
@@ -171,7 +176,8 @@ class Many extends AuthController
             'sort',
             'increase',
             'second',
-            'single'
+            'single',
+            'lower_limit'
         ]);
         $validate = Validate::rule('name', 'require')->rule([
             'name' => 'require',
@@ -181,6 +187,7 @@ class Many extends AuthController
             'add_time' => 'require',
             'end_time' => 'require',
             'single' => 'require',
+            'lower_limit' => 'require',
         ]);
         $validate->message([
             'name.require' => '名称不能为空',
@@ -190,6 +197,7 @@ class Many extends AuthController
             'add_time.require' => '请选择进场时间',
             'end_time.require' => '请选择结束时间',
             'single.require' => '请填写单次上限',
+            'lower_limit.require' => '请填写单次下限',
         ]);
         if (!$validate->check($data)) {
             return Json::fail($validate->getError());
@@ -197,6 +205,7 @@ class Many extends AuthController
         $details = $model->find($data['id']);
         $details['name'] = $data['name'];
         $details['single'] = $data['single'];
+        $details['lower_limit'] = $data['lower_limit'];
 //        $details['image'] = $data['image'];
         $details['money'] = $data['money'];
         $details['increase'] = $data['increase'];

+ 3 - 5
app/admin/controller/setting/SystemConfig.php

@@ -378,18 +378,16 @@ class SystemConfig extends AuthController
         $upload_type = sys_config('upload_type');
         try{
             $ossClient = new OssClient($accessKeyId, $accessKeySecret, $storage_region);
-            $ossClient->uploadFile($storage_name, $res->filePath, sys_config('site_url').'/'.$res->filePath);
+            $result = $ossClient->uploadFile($storage_name, $res->fileName, $_SERVER['DOCUMENT_ROOT'].'/'.$res->filePath);
 
         } catch(OssException $e) {
             printf(__FUNCTION__ . ": FAILED\n");
             printf($e->getMessage() . "\n");
             return;
         }
-        print(__FUNCTION__ . "OK" . "\n");
-        exit();
-
+        $res = \app\admin\model\system\SystemConfig::where('menu_name','apk')->update(['value' => $result['info']['url']]);
         if ($res === false) return Json::fail($upload->getError());
-        return Json::successful('上传成功!', ['filePath' => $res->filePath]);
+        return Json::successful('上传成功!', ['filePath' => $result['info']['url']]);
     }
 
 }

+ 4 - 2
app/admin/controller/store/StoreProduct.php

@@ -275,7 +275,8 @@ class StoreProduct extends AuthController
             ['activity', []],
             ['store_type', 1],
             ['white_integral', 1],
-            ['business_integral', 1]
+            ['business_integral', 1],
+            ['is_luck', 0]
         ]);
         foreach ($data['activity'] as $k => $v) {
             if ($v == '秒杀') {
@@ -475,7 +476,8 @@ class StoreProduct extends AuthController
             ['is_postage', 0],
             ['is_good', 0],
             ['white_integral', 1],
-            ['business_integral', 1]
+            ['business_integral', 1],
+            ['is_luck', 0]
         ]);
         if (count($data['cate_id']) < 1) return Json::fail('请选择产品分类');
         $cate_id = $data['cate_id'];

+ 6 - 0
app/admin/controller/user/User.php

@@ -345,8 +345,10 @@ class User extends AuthController
         $f[] = Form::input('flowing_water', '流水分红', $user->getData('flowing_water'));
         $f[] = Form::textarea('mark', '用户备注', $user->getData('mark'));
         $f[] = Form::radio('is_promoter', '推广员', $user->getData('is_promoter'))->options([['value' => 1, 'label' => '开启'], ['value' => 0, 'label' => '关闭']]);
+        $f[] = Form::select('identification', '标识', (string)$user->getData('identification'))->options(array_merge([['value' => 0, 'label' => '无']], [['value' => 1, 'label' => '分公司'],['value' => 2, 'label' => '运营中心'],['value' => 3, 'label' => '服务中心']]))->filterable(true);
         $f[] = Form::select('spread_uid', '推荐人', (string)$user->getData('spread_uid'))->options(array_merge([['value' => 0, 'label' => '无']], UserModel::where('uid', '<>', $uid)->field('uid as value,phone as label')->select()->toArray()))->filterable(true);
         $f[] = Form::radio('status', '状态', $user->getData('status'))->options([['value' => 1, 'label' => '开启'], ['value' => 0, 'label' => '锁定']]);
+        $f[] = Form::radio('blacklist', '黑名单', $user->getData('blacklist'))->options([['value' => 1, 'label' => '开启'], ['value' => 0, 'label' => '锁定']]);
         $form = Form::make_post_form('添加用户通知', $f, Url::buildUrl('update', array('uid' => $uid)), 5);
         $this->assign(compact('form'));
         return $this->fetch('public/form-builder');
@@ -370,6 +372,8 @@ class User extends AuthController
             ['flowing_water', 0],
             ['city', ''],
             ['area', ''],
+            ['blacklist'],
+            ['identification']
         ]);
         if (!$uid) return $this->failed('数据不存在');
         $user = UserModel::get($uid);
@@ -437,6 +441,8 @@ class User extends AuthController
         $edit['mark'] = $data['mark'];
         $edit['is_promoter'] = $data['is_promoter'];
         $edit['flowing_water'] = $data['flowing_water'];
+        $edit['blacklist'] = $data['blacklist'];
+        $edit['identification'] = $data['identification'];
         $edit['city'] = trim($data['city'],'');
         $edit['area'] = trim($data['area'], '');
         if ($edit) $res3 = UserModel::edit($edit, $uid);

+ 0 - 7
app/admin/controller/wechat/index.php

@@ -1,7 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: Administrator
- * Date: 2018/4/18 0018
- * Time: 上午 10:44
- */

+ 57 - 0
app/admin/model/luck/LuckDraw.php

@@ -0,0 +1,57 @@
+<?php
+/**
+ * @author: xaboy<365615158@qq.com>
+ * @day: 2017/11/11
+ */
+
+namespace app\admin\model\luck;
+
+use crmeb\traits\ModelTrait;
+use crmeb\basic\BaseModel;
+use think\model\concern\SoftDelete;
+
+/**
+ * Class StoreCategory
+ * @package app\admin\model\store
+ */
+class LuckDraw extends BaseModel
+{
+
+    /**
+     * 数据表主键
+     * @var string
+     */
+    protected $pk = 'id';
+
+    /**
+     * 模型名称
+     * @var string
+     */
+    protected $name = 'luck_draw';
+
+    use ModelTrait;
+    protected $autoWriteTimestamp = true;
+
+
+
+    public static function list($where)
+    {
+        $model = self::field('*')->order('id DESC');
+
+        if ($where['name'])$model->where('name' , 'like', '%'.$where['name'],'%');
+        if ($where['status'])$model->where('status' , '=', $where['status']);
+        $data['count'] = $model->count();
+        if ($where['page'] && $where['limit']){
+            $model->page($where['page'], $where['limit']);
+        }else{
+            $model->page(20, 1);
+        }
+        $list = $model->select()->toArray();
+
+        $data['data'] = $list;
+        return $data;
+
+    }
+
+
+}

+ 58 - 0
app/admin/model/luck/LuckOrder.php

@@ -0,0 +1,58 @@
+<?php
+/**
+ * @author: xaboy<365615158@qq.com>
+ * @day: 2017/11/11
+ */
+
+namespace app\admin\model\luck;
+
+use crmeb\traits\ModelTrait;
+use crmeb\basic\BaseModel;
+use think\model\concern\SoftDelete;
+
+/**
+ * Class StoreCategory
+ * @package app\admin\model\store
+ */
+class LuckOrder extends BaseModel
+{
+
+    /**
+     * 数据表主键
+     * @var string
+     */
+    protected $pk = 'id';
+
+    /**
+     * 模型名称
+     * @var string
+     */
+    protected $name = 'luck_order';
+
+    use ModelTrait;
+    protected $autoWriteTimestamp = true;
+
+
+
+    public static function list($where)
+    {
+        $model = self::alias('a')
+            ->field('a.*,b.nickname')
+            ->leftJoin('user b', 'a.uid = b.uid')
+            ->order('a.id DESC');
+
+        if ($where['name'])$model->where('b.nickname|b.uid' , 'like', '%'.$where['name'],'%');
+        $data['count'] = $model->count();
+        if ($where['page'] && $where['limit']){
+            $model->page($where['page'], $where['limit']);
+        }else{
+            $model->page(20, 1);
+        }
+        $list = $model->select()->toArray();
+        $data['data'] = $list;
+        return $data;
+
+    }
+
+
+}

+ 1 - 1
app/admin/model/user/UserExtract.php

@@ -98,7 +98,7 @@ class UserExtract extends BaseModel
     {
         $fail_time = time();
         $data = self::get($id);
-        $extract_number = $data['extract_price'];
+        $extract_number = $data['money'];
         $mark = '提现失败,退回阳光积分' . $extract_number;
         $uid = $data['uid'];
         $status = -1;

+ 1 - 1
app/admin/view/login/index.php

@@ -4,7 +4,7 @@
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <meta name="robots" content="noindex,nofollow" />
-    <title>登录管理系统 -  Powered by CRMEB!</title>
+    <title>登录管理系统</title>
     <meta name="generator" content="CRMEB! v2.5" />
     <meta name="author" content="CRMEB! Team and CRMEB UI Team" />
     <link href="{__FRAME_PATH}css/bootstrap.min.css?v=3.4.0" rel="stylesheet">

+ 192 - 0
app/admin/view/luck/luck_draw/index.php

@@ -0,0 +1,192 @@
+{extend name="public/container"}
+{block name="head_top"}
+
+{/block}
+{block name="content"}
+<style>
+    .btn-outline{
+        border:none;
+    }
+    .btn-outline:hover{
+        background-color: #0e9aef;
+        color: #fff;
+    }
+    .layui-form-item .layui-btn {
+        margin-top: 5px;
+        margin-right: 10px;
+    }
+    .layui-btn-primary{
+        margin-right: 10px;
+        margin-left: 0!important;
+    }
+    label{
+        margin-bottom: 0!important;
+        margin-top: 4px;
+    }
+</style>
+<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-carousel layadmin-carousel layadmin-shortcut" lay-anim="" lay-indicator="inside" lay-arrow="none" style="background:none">
+<!--                        <form class="layui-form layui-form-pane" action="">-->
+<!--                            <div class="layui-form-item">-->
+<!---->
+<!--                                <div class="layui-col-lg12">-->
+<!--                                    <label class="layui-form-label" style="top: -5.5px;">搜索条件</label>-->
+<!--                                    <div class="layui-input-inline">-->
+<!--                                        <input type="text" id="name" name="name" class="layui-input" placeholder="请输入名称">-->
+<!--                                    </div>-->
+<!--                                </div>-->
+<!--                                <div class="layui-inline">-->
+<!--                                    <div class="layui-input-inline">-->
+<!--                                        <button class="layui-btn layui-btn-sm layui-btn-normal" lay-submit="search" lay-filter="search">-->
+<!--                                            <i class="layui-icon layui-icon-search"></i>搜索</button>-->
+<!--                                    </div>-->
+<!--                                </div>-->
+<!--                            </div>-->
+<!--                        </form>-->
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <!-- 中间详细信息-->
+        <div :class="item.col!=undefined ? 'layui-col-sm'+item.col+' '+'layui-col-md'+item.col:'layui-col-sm6 layui-col-md3'"
+             v-for="item in badge" v-cloak="" v-if="item.count > 0">
+        </div>
+        <!--enb-->
+    </div>
+    <!--列表-->
+    <div class="layui-row layui-col-space15">
+        <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" id="container-action">
+<!--                        <a class="layui-btn layui-btn-sm" onclick="$eb.createModalFrame(this.innerText,'{:Url('create')}',{h:700,w:1100})">添加众筹</a>-->
+<!--                        <button class="layui-btn layui-btn-sm" data-type="del_auction">批量删除</button>-->
+                    </div>
+                    <table class="layui-hide" id="List" lay-filter="List"></table>
+
+
+                    <script type="text/html" id="image">
+                        <img style="cursor: pointer" lay-event="open_image" src="{{d.image}}">
+                    </script>
+                    <script type="text/html" id="status">
+                        {{#  if(d.status == 0){ }}
+                        <button type="button" name="suc" class="layui-btn-disabled layui-btn-xs" id="">
+                            关闭
+                        </button>
+                        {{#  } else if(d.status == 1) { }}
+                        <button type="button" name="suc" class="layui-btn-xs layui-btn" id="">
+                            开启
+                        </button>
+                        {{#  } }}
+                    </script>
+                    <script type="text/html" id="suc">
+                        {{#  if(d.suc == 0){ }}
+                        <button type="button" name="suc" class="layui-btn layui-btn-xs" id="">
+                            正常
+                        </button>
+                        {{#  } else if(d.suc == 1) { }}
+                        <button type="button" name="suc" class="layui-btn-xs layui-btn" id="">
+                            众筹成功
+                        </button>
+                        {{#  } else if(d.suc == 2) { }}
+                        <button type="button" name="suc" class="layui-btn-disabled layui-btn-xs layui-btn-danger" id="">
+                            众筹失败
+                        </button>
+                        {{#  } }}
+                    </script>
+                    <script type="text/html" id="act">
+<!--                        <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" onclick="$eb.createModalFrame('编辑','{:Url('next')}?id={{d.id}}',{h:700,w:1100})">-->
+<!--                            下一期-->
+<!--                        </button>-->
+                        <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" onclick="$eb.createModalFrame('编辑','{:Url('edit')}?id={{d.id}}',{h:700,w:1100})">
+                            编辑
+                        </button>
+<!--                        <button type="button" class="layui-btn layui-btn-xs layui-btn-danger" lay-event='delete' id="">-->
+<!--                            删除-->
+<!--                        </button>-->
+
+                    </script>
+                </div>
+            </div>
+        </div>
+    </div>
+    <!--end-->
+</div>
+<script src="{__ADMIN_PATH}js/layuiList.js"></script>
+{/block}
+{block name="script"}
+<script>
+    layList.tableList('List', "{:Url('list')}", function () {
+        return [
+            {type: 'checkbox'},
+            {field: 'id', title: 'ID', sort: true, event: 'id', width: '5%', templet: '#id'},
+            {field: 'title', title: '名称', templet: '#v',  align: 'center'},
+            // {field: 'image', title: '封面', templet: '#image', align: 'center', width: '5%'},
+            {field: 'count', title: '新人抽奖数量', align: 'center'},
+            {field: 'probability', title: '概率%', align: 'center'},
+            {field: 'price', title: '抽奖价格', align: 'center'},
+            {field: 'right', title: '操作', align: 'center', toolbar: '#act',width: '15%'},
+        ];
+    });
+
+    //查询
+    layList.search('search',function(where){
+        layList.reload(where,true);
+    });
+
+    //点击事件绑定
+    layList.tool(function (event,data,obj) {
+        switch (event) {
+            case 'delete':
+                var url=layList.U({c:'many.many',a:'delete',q:{id:data.id}});
+                var code = {title:"操作提示",text:"确定将该商品移入回收站吗?",type:'info',confirm:'是的,移入回收站'};
+                $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.del();
+                            location.reload();
+                        }else
+                            return Promise.reject(res.data.msg || '删除失败')
+                    }).catch(function(err){
+                        $eb.$swal('error',err);
+                    });
+                },code)
+                break;
+            case 'open_image':
+                $eb.openImage(data.image);
+                break;
+            case 'edit':
+                location.href = layList.U({a:'edit',q:{id:data.id}});
+                break;
+        }
+    })
+
+
+    //改状态
+    layList.switch('status',function (odj,value) {
+        if(odj.elem.checked==true){
+            layList.baseGet(layList.Url({c:'auction.auction',a:'set_status',p:{status:1,id:value}}),function (res) {
+                layList.msg(res.msg, function () {
+                    layList.reload();
+                });
+            });
+        }else{
+            layList.baseGet(layList.Url({c:'auction.auction',a:'set_status',p:{status:0,id:value}}),function (res) {
+                layList.msg(res.msg, function () {
+                    layList.reload();
+                });
+            });
+        }
+    });
+</script>
+{/block}

+ 189 - 0
app/admin/view/luck/luck_order/index.php

@@ -0,0 +1,189 @@
+{extend name="public/container"}
+{block name="head_top"}
+
+{/block}
+{block name="content"}
+<style>
+    .btn-outline{
+        border:none;
+    }
+    .btn-outline:hover{
+        background-color: #0e9aef;
+        color: #fff;
+    }
+    .layui-form-item .layui-btn {
+        margin-top: 5px;
+        margin-right: 10px;
+    }
+    .layui-btn-primary{
+        margin-right: 10px;
+        margin-left: 0!important;
+    }
+    label{
+        margin-bottom: 0!important;
+        margin-top: 4px;
+    }
+</style>
+<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-carousel layadmin-carousel layadmin-shortcut" lay-anim="" lay-indicator="inside" lay-arrow="none" style="background:none">
+                        <form class="layui-form layui-form-pane" action="">
+                            <div class="layui-form-item">
+
+                                <div class="layui-col-lg12">
+                                    <label class="layui-form-label" style="top: -5.5px;">搜索条件</label>
+                                    <div class="layui-input-inline">
+                                        <input type="text" id="name" name="name" class="layui-input" placeholder="请输入用户名称Id">
+                                    </div>
+                                </div>
+                                <div class="layui-inline">
+                                    <div class="layui-input-inline">
+                                        <button class="layui-btn layui-btn-sm layui-btn-normal" lay-submit="search" lay-filter="search">
+                                            <i class="layui-icon layui-icon-search"></i>搜索</button>
+                                    </div>
+                                </div>
+                            </div>
+                        </form>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <!-- 中间详细信息-->
+        <div :class="item.col!=undefined ? 'layui-col-sm'+item.col+' '+'layui-col-md'+item.col:'layui-col-sm6 layui-col-md3'"
+             v-for="item in badge" v-cloak="" v-if="item.count > 0">
+        </div>
+        <!--enb-->
+    </div>
+    <!--列表-->
+    <div class="layui-row layui-col-space15">
+        <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" id="container-action">
+<!--                        <a class="layui-btn layui-btn-sm" onclick="$eb.createModalFrame(this.innerText,'{:Url('create')}',{h:700,w:1100})">添加众筹</a>-->
+<!--                        <button class="layui-btn layui-btn-sm" data-type="del_auction">批量删除</button>-->
+                    </div>
+                    <table class="layui-hide" id="List" lay-filter="List"></table>
+
+
+                    <script type="text/html" id="image">
+                        <img style="cursor: pointer" lay-event="open_image" src="{{d.image}}">
+                    </script>
+                    <script type="text/html" id="status">
+                        {{#  if(d.status == 0){ }}
+                        <button type="button" name="suc" class="layui-btn-disabled layui-btn-xs" id="">
+                            失败
+                        </button>
+                        {{#  } else if(d.status == 1) { }}
+                        <button type="button" name="suc" class="layui-btn-xs layui-btn" id="">
+                            成功
+                        </button>
+                        {{#  } }}
+                    </script>
+                    <script type="text/html" id="state">
+                        {{#  if(d.status == 0){ }}
+                        <button type="button" name="suc" class="layui-btn-disabled layui-btn-xs" id="">
+                            退回
+                        </button>
+                        {{#  } else if(d.status == 1) { }}
+                        <button type="button" name="suc" class="layui-btn-xs layui-btn" id="">
+                            正常
+                        </button>
+                        {{#  } }}
+                    </script>
+                    <script type="text/html" id="act">
+<!--                        <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" onclick="$eb.createModalFrame('编辑','{:Url('next')}?id={{d.id}}',{h:700,w:1100})">-->
+<!--                            下一期-->
+<!--                        </button>-->
+<!--                        <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" onclick="$eb.createModalFrame('编辑','{:Url('edit')}?id={{d.id}}',{h:700,w:1100})">-->
+<!--                            编辑-->
+<!--                        </button>-->
+                        <button type="button" class="layui-btn layui-btn-xs layui-btn-danger" lay-event='delete' id="">
+                            删除
+                        </button>
+
+                    </script>
+                </div>
+            </div>
+        </div>
+    </div>
+    <!--end-->
+</div>
+<script src="{__ADMIN_PATH}js/layuiList.js"></script>
+{/block}
+{block name="script"}
+<script>
+    layList.tableList('List', "{:Url('list')}", function () {
+        return [
+            {type: 'checkbox'},
+            {field: 'id', title: 'ID', sort: true, event: 'id', width: '5%', templet: '#id'},
+            {field: 'nickname', title: '用户昵称',  align: 'center'},
+            // {field: 'image', title: '封面', templet: '#image', align: 'center', width: '5%'},
+            {field: 'price', title: '投入金额', align: 'center'},
+            {field: 'status', title: '状态', templet: '#status',align: 'center'},
+            {field: 'state', title: '退回状态',templet: '#state', align: 'center'},
+            {field: 'create_time', title: '时间', align: 'center'},
+            {field: 'right', title: '操作', align: 'center', toolbar: '#act',width: '15%'},
+        ];
+    });
+
+    //查询
+    layList.search('search',function(where){
+        layList.reload(where,true);
+    });
+
+    //点击事件绑定
+    layList.tool(function (event,data,obj) {
+        switch (event) {
+            case 'delete':
+                var url=layList.U({c:'many.many',a:'delete',q:{id:data.id}});
+                var code = {title:"操作提示",text:"确定将该商品移入回收站吗?",type:'info',confirm:'是的,移入回收站'};
+                $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.del();
+                            location.reload();
+                        }else
+                            return Promise.reject(res.data.msg || '删除失败')
+                    }).catch(function(err){
+                        $eb.$swal('error',err);
+                    });
+                },code)
+                break;
+            case 'open_image':
+                $eb.openImage(data.image);
+                break;
+            case 'edit':
+                location.href = layList.U({a:'edit',q:{id:data.id}});
+                break;
+        }
+    })
+
+
+    //改状态
+    layList.switch('status',function (odj,value) {
+        if(odj.elem.checked==true){
+            layList.baseGet(layList.Url({c:'auction.auction',a:'set_status',p:{status:1,id:value}}),function (res) {
+                layList.msg(res.msg, function () {
+                    layList.reload();
+                });
+            });
+        }else{
+            layList.baseGet(layList.Url({c:'auction.auction',a:'set_status',p:{status:0,id:value}}),function (res) {
+                layList.msg(res.msg, function () {
+                    layList.reload();
+                });
+            });
+        }
+    });
+</script>
+{/block}

+ 2 - 2
app/admin/view/many/many/index.php

@@ -95,11 +95,11 @@
                         </button>
                         {{#  } else if(d.suc == 1) { }}
                         <button type="button" name="suc" class="layui-btn-xs layui-btn" id="">
-                            众筹成功
+                            种植成功
                         </button>
                         {{#  } else if(d.suc == 2) { }}
                         <button type="button" name="suc" class="layui-btn-disabled layui-btn-xs layui-btn-danger" id="">
-                            众筹失败
+                            种植失败
                         </button>
                         {{#  } }}
                     </script>

+ 1 - 0
app/admin/view/order/store_order/index.php

@@ -542,6 +542,7 @@
             {field: 'spread_uid', title: '推荐人信息', templet: '#spread_uid', width: '10%', align: 'center'},
             {field: 'info', title: '商品信息', templet: "#info", height: 'full-20'},
             {field: 'pay_price', title: '实际支付', width: '8%', align: 'center'},
+            {field: 'cumulative', title: '累计金额', width: '8%', align: 'center'},
             {field: 'paid', title: '支付状态', templet: '#paid', width: '8%', align: 'center'},
             {field: 'status', title: '订单状态', templet: '#status', width: '8%', align: 'center'},
             {field: 'add_time', title: '下单时间', width: '10%', sort: true, align: 'center'},

+ 17 - 16
app/admin/view/store/store_product/create.php

@@ -884,21 +884,21 @@
                                             </div>
                                         </div>
                                     </div>
-<!--                                    <div class="layui-col-xs12 layui-col-sm4 layui-col-md4">-->
-<!--                                        <div class="grid-demo grid-demo-bg1">-->
-<!--                                            <div class="layui-form-item">-->
-<!--                                                <label class="layui-form-label">促销单品</label>-->
-<!--                                                <div class="layui-input-block">-->
-<!--                                                    <input type="radio" name="is_benefit" lay-filter="is_benefit"-->
-<!--                                                           value="1" title="开启"-->
-<!--                                                           :checked="formData.is_benefit == 1 ? true : false">-->
-<!--                                                    <input type="radio" name="is_benefit" lay-filter="is_benefit"-->
-<!--                                                           value="0" title="关闭"-->
-<!--                                                           :checked="formData.is_benefit == 0 ? true : false">-->
-<!--                                                </div>-->
-<!--                                            </div>-->
-<!--                                        </div>-->
-<!--                                    </div>-->
+                                    <div class="layui-col-xs12 layui-col-sm4 layui-col-md4">
+                                        <div class="grid-demo grid-demo-bg1">
+                                            <div class="layui-form-item">
+                                                <label class="layui-form-label">新人专享</label>
+                                                <div class="layui-input-block">
+                                                    <input type="radio" name="is_luck" lay-filter="is_luck"
+                                                           value="1" title="开启"
+                                                           :checked="formData.is_luck == 1 ? true : false">
+                                                    <input type="radio" name="is_luck" lay-filter="is_luck"
+                                                           value="0" title="关闭"
+                                                           :checked="formData.is_luck == 0 ? true : false">
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
 <!--                                    <div class="layui-col-xs12 layui-col-sm4 layui-col-md4">-->
 <!--                                        <div class="grid-demo grid-demo-bg1">-->
 <!--                                            <div class="layui-form-item">-->
@@ -1060,6 +1060,7 @@
                 is_good: 0,
                 store_type: 1,
                 is_sub: 0,
+                is_luck:0,
                 items: [
                     // {
                     //     value: '',
@@ -1097,7 +1098,7 @@
             activity: {'秒杀': '#1E9FFF', '砍价': '#189688', '拼团': '#FEB900'},
             attr: [],//临时属性
             newRule: false,//是否添加新规则
-            radioRule: ['store_type', 'is_sub', 'is_show', 'is_hot', 'is_benefit', 'is_new', 'is_good', 'is_best', 'spec_type'],//radio 当选规则
+            radioRule: ['store_type', 'is_sub', 'is_show', 'is_hot', 'is_benefit', 'is_new', 'is_good', 'is_best', 'spec_type', 'is_luck'],//radio 当选规则
             rule: { //多图选择规则
                 slider_image: {
                     maxLength: 5

+ 26 - 27
app/admin/view/user/user/index.php

@@ -56,10 +56,10 @@
                 </div>
             </div>
             <div class="ibox-content" style="display: block;">
-<!--                <div class="alert alert-success alert-dismissable">-->
-<!--                    <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>-->
-<!--                    目前拥有{$count_user}个会员-->
-<!--                </div>-->
+                <!--                <div class="alert alert-success alert-dismissable">-->
+                <!--                    <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>-->
+                <!--                    目前拥有{$count_user}个会员-->
+                <!--                </div>-->
                 <form class="layui-form">
                     <div class="layui-form-item">
                         <div class="layui-inline">
@@ -203,13 +203,13 @@
             <div class="ibox-content">
                 <div class="table-responsive">
                     <div class="layui-btn-group conrelTable">
-<!--                        <button class="layui-btn layui-btn-sm layui-btn-danger" type="button" data-type="set_status_f"><i class="fa fa-ban"></i>封禁</button>-->
-<!--                        <button class="layui-btn layui-btn-sm layui-btn-normal" type="button" data-type="set_status_j"><i class="fa fa-check-circle-o"></i>解封</button>-->
+                        <!--                        <button class="layui-btn layui-btn-sm layui-btn-danger" type="button" data-type="set_status_f"><i class="fa fa-ban"></i>封禁</button>-->
+                        <!--                        <button class="layui-btn layui-btn-sm layui-btn-normal" type="button" data-type="set_status_j"><i class="fa fa-check-circle-o"></i>解封</button>-->
                         <button class="layui-btn layui-btn-sm layui-btn-normal" type="button" data-type="set_grant"><i class="fa fa-check-circle-o"></i>发送优惠券</button>
                         <button class="layui-btn layui-btn-sm layui-btn-normal" type="button" data-type="set_custom"><i class="fa fa-check-circle-o"></i>发送客服图文消息</button>
                         <button class="layui-btn layui-btn-sm layui-btn-normal" type="button" data-type="set_group"><i class="fa fa-check-circle-o" ></i>批量设置分组</button>
-<!--                        <button class="layui-btn layui-btn-sm layui-btn-normal" type="button" data-type="set_template"><i class="fa fa-check-circle-o"></i>发送模板消息</button>-->
-<!--                        <button class="layui-btn layui-btn-sm layui-btn-normal" type="button" data-type="set_info"><i class="fa fa-check-circle-o"></i>发送站内消息</button>-->
+                        <!--                        <button class="layui-btn layui-btn-sm layui-btn-normal" type="button" data-type="set_template"><i class="fa fa-check-circle-o"></i>发送模板消息</button>-->
+                        <!--                        <button class="layui-btn layui-btn-sm layui-btn-normal" type="button" data-type="set_info"><i class="fa fa-check-circle-o"></i>发送站内消息</button>-->
                         <button class="layui-btn layui-btn-sm layui-btn-normal" type="button" data-type="refresh"><i class="layui-icon layui-icon-refresh" ></i>刷新</button>
                     </div>
                     <table class="layui-hide" id="userList" lay-filter="userList"></table>
@@ -221,23 +221,22 @@
                     </script>
                     <script type="text/html" id="effective">
                         {{# if(d.effective == 1){ }}
-                            有效
+                        有效
                         {{#  } else if(d.effective == 0) { }}
-                            无效
+                        无效
                         {{# } }}
                     </script>
                     <script type="text/html" id="is_merchant">
                         {{# if(d.is_merchant == 1){ }}
-                            
+                        是
                         {{#  } else if(d.is_merchant == 0) { }}
-                            
+                        否
                         {{# } }}
                     </script>
                     <script type="text/html" id="flowing_water">
                         {{d.flowing_water}}%
                     </script>
                     <script type="text/html" id="data_time">
-                        <p>首次:{{d.add_time}}</p>
                         <p>最近:{{d.last_time}}</p>
                     </script>
                     <script type="text/html" id="checkboxstatus">
@@ -327,7 +326,7 @@
         return [
             {type:'checkbox'},
             {field: 'uid', title: '编号',event:'uid',width:'4%',align:'center'},
-            {field: 'avatar', title: '头像', event:'open_image', width: '6%',align:'center', templet: '<p lay-event="open_image"><img class="avatar" style="cursor: pointer" class="open_image" data-image="{{d.avatar}}" src="{{d.avatar}}" alt="{{d.nickname}}"></p>'},
+            // {field: 'avatar', title: '头像', event:'open_image', width: '6%',align:'center', templet: '<p lay-event="open_image"><img class="avatar" style="cursor: pointer" class="open_image" data-image="{{d.avatar}}" src="{{d.avatar}}" alt="{{d.nickname}}"></p>'},
             {field: 'nickname', title: '姓名',templet:'#nickname',align:'center'},
             {field: 'phone', title: '手机号',align:'center',width:'8%'},
             {field: 'now_money', title: '余额',sort:true,event:'now_money',align:'center'},
@@ -336,11 +335,11 @@
             {field: 'integral', title: '商城积分',sort:true,event:'integral',align:'center'},
             {field: 'white_integral', title: '红积分',sort:true,event:'white_integral',align:'center'},
             {field: 'purple_integral', title: '阳光积分',sort:true,event:'purple_integral',align:'center'},
-            {field: 'green_integral', title: '吉祥积分',sort:true,event:'green_integral',align:'center'},
-            {field: 'business_integral', title: '喜嗨积分',sort:true,event:'business_integral',align:'center'},
-            {field: 'paper_ticket', title: '文票',sort:true,event:'paper_ticket',align:'center'},
+            // {field: 'green_integral', title: '吉祥积分',sort:true,event:'green_integral',align:'center'},
+            // {field: 'business_integral', title: '喜嗨积分',sort:true,event:'business_integral',align:'center'},
+            // {field: 'paper_ticket', title: '文票',sort:true,event:'paper_ticket',align:'center'},
             {field: 'spread_uid_nickname', title: '推荐人',align:'center'},
-            {field: 'sex', title: '性别',width:'4%',align:'center'},
+            // {field: 'sex', title: '性别',width:'4%',align:'center'},
             {field: 'data_time', title: '访问日期',align:'center',width:'12%',templet:'#data_time'},
             // {field: 'status', title: '状态',templet:"#checkboxstatus",width:'6%',align:'center'},
             {field: 'effective', title: '账户状态',templet:"#effective",align:'center'},
@@ -462,15 +461,15 @@
 
     var action={
         set_status_f:function () {
-           var ids=layList.getCheckData().getIds('uid');
-           if(ids.length){
-               layList.basePost(layList.Url({a:'set_status',p:{is_echo:1,status:0}}),{uids:ids},function (res) {
-                   layList.msg(res.msg);
-                   layList.reload();
-               });
-           }else{
-               layList.msg('请选择要封禁的会员');
-           }
+            var ids=layList.getCheckData().getIds('uid');
+            if(ids.length){
+                layList.basePost(layList.Url({a:'set_status',p:{is_echo:1,status:0}}),{uids:ids},function (res) {
+                    layList.msg(res.msg);
+                    layList.reload();
+                });
+            }else{
+                layList.msg('请选择要封禁的会员');
+            }
         },
         set_status_j:function () {
             var ids=layList.getCheckData().getIds('uid');

+ 6 - 2
app/api/controller/AuthController.php

@@ -59,6 +59,8 @@ class AuthController
         $token = UserToken::createToken($user, 'user');
 
         if ($token) {
+            $user['last_time'] = time();
+            $user->save();
             event('UserLogin', [$user, $token]);
             return app('json')->success('登录成功', ['token' => $token->token, 'expires_time' => $token->expires_time]);
         } else
@@ -188,7 +190,7 @@ class AuthController
         if (SmsRecord::where('add_ip', $request->ip())->whereDay('add_time')->count() >= $maxIpCount) {
             return app('json')->fail('此IP今日发送次数已经达到上限');
         }
-        $time = 60;
+        $time = 300;
 //        if (CacheService::get('code_' . $phone))
 //            return app('json')->fail($time . '秒内有效');
         $code = rand(100000, 999999);
@@ -201,7 +203,7 @@ class AuthController
 //        Cache::set($keyName, $num + 1, 300);
 //        Cache::set($nowKey, $total, 61);
 
-        return app('json')->success('短信验证发送成功');
+        return app('json')->success('短信验证发送成功,有效期5分钟');
     }
 
     /**
@@ -244,6 +246,8 @@ class AuthController
         } catch (ValidateException $e) {
             return app('json')->fail($e->getError());
         }
+        if (!$spread) return app('json')->fail('请填写邀请码');
+        if (!User::where('uid', $spread)->find()) return app('json')->fail('邀请码用户不存在');
         $verifyCode = CacheService::get('code_' . $account);
         if (!$verifyCode)
             return app('json')->fail('请先获取验证码');

+ 188 - 0
app/api/controller/luck/LuckController.php

@@ -0,0 +1,188 @@
+<?php
+
+namespace app\api\controller\luck;
+
+
+use app\admin\model\luck\LuckDraw;
+use app\admin\model\luck\LuckOrder;
+use app\admin\model\store\StoreProduct;
+use app\admin\model\store\StoreProductAttrValue;
+use app\models\many\Many;
+use app\models\many\ManyGreen;
+use app\models\many\ManyOrder;
+use app\models\store\StoreCart;
+use app\models\store\StoreOrder;
+use app\models\store\StoreOrderCartInfo;
+use app\models\store\StoreOrderStatus;
+use app\models\user\User;
+use app\models\user\UserAddress;
+use app\models\user\UserBill;
+use app\Request;
+use crmeb\services\GroupDataService;
+use crmeb\services\QrcodeService;
+use crmeb\services\SystemConfigService;
+use crmeb\services\UtilService;
+use crmeb\services\upload\Upload;
+use think\facade\Db;
+
+/**
+ * 账单类
+ * Class UserBillController
+ * @package app\api\controller\user
+ */
+class LuckController
+{
+
+    /**
+     * 新人专享参数
+     * @param Request $request
+     * @return mixed
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
+    public function luck_draw(Request $request)
+    {
+        $data = LuckDraw::where('id', 1)->find()->toArray();
+        $count = LuckOrder::where('uid', $request->uid())->count();
+        $data['count'] -= $count;
+        return app('json')->success($data);
+    }
+
+
+    /**
+     * 抽奖
+     * @param Request $request
+     * @return mixed
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
+    public function luck(Request $request)
+    {
+        Db::startTrans();
+        $luck = LuckDraw::where('id', 1)->find();
+        $product = StoreProduct::where('is_luck', 1)->select();
+        $user = User::where('uid', $request->uid())->find();
+        $luckOrder = LuckOrder::where('uid', $request->uid())->count();
+//        if ($user['add_time']+(86400*7) < time()) return app('json')->fail('新人一周内才可以购买');
+        if ($luckOrder >= $luck['count']) return app('json')->fail('最大抽奖数'.$luck['count']);
+        if ($user['white_integral'] < $luck['price']) return app('json')->fail('红积分不足');
+        $probability = $luck['probability'];
+        $data = [];
+        $data[] = ['id' => 0, 'title' => '未中奖','v' => 100-$probability];
+        foreach ($product as $item){
+            $data[] = ['id' => $item['id'], 'title' => $item['store_name'],'v' => $probability/count($product)];
+        }
+        foreach ($data as $key => $val) {
+            $arr[$val['id']] = $val['v']; //将$prize_arr放入数组下标为$prize_arr的id元素,值为v元素的数组中
+        }
+        $rid = get_rand($arr);
+        if ($rid == 0){
+            $res = LuckOrder::create([
+                'luck_id' => 1,
+                'uid' => $request->uid(),
+                'price' => $luck['price'],
+                'status' => 0,
+                'state' => 0,
+            ]);
+
+            if ($res) {
+                Db::commit();
+                return app('json')->fail('未中奖,不扣除', ['product' => 0]);
+            }
+        }else{
+            $user_add = UserAddress::where('uid', $request->uid())->find();
+            if (!$user_add) return app('json')->fail('请填写地址', ['address' => 0]);
+            $products = StoreProduct::where('id', $rid)->find();
+            $productArrtValue = StoreProductAttrValue::where('product_id', $products['id'])->find();
+            $cart_id = StoreCart::create([
+                'uid' => $request->uid(),
+                'type' => 'product',
+                'product_id' => $products['id'],
+                'product_attr_unique' => $productArrtValue['unique'],
+                'cart_num' => 1,
+                'add_time' => time(),
+                'is_new' => 1,
+            ]);
+            $cartGroup = StoreCart::getUserProductCartList($request->uid(), $cart_id['id'], 1);
+            $cartInfo = $cartGroup['valid'];
+            $cartIds = [];
+            $totalNum = 0;
+            $gainIntegral = 0;
+            $whiteIntegral = 0;
+            $businessIntegral = 0;
+            foreach ($cartInfo as $cart) {
+                $cartIds[] = $cart['id'];
+                $totalNum += $cart['cart_num'];
+                // if ($cart['productInfo']['cate_id'] == 4 and $useIntegral) return self::setErrorInfo('该商品不能抵扣', true);
+                $cartInfoGainIntegral = isset($cart['productInfo']['give_integral']) ? bcmul($cart['cart_num'], $cart['productInfo']['give_integral'], 2) : 0;
+                $whiteInfoGainIntegral = isset($cart['productInfo']['white_integral']) ? bcmul($cart['cart_num'], $cart['productInfo']['white_integral'], 2) : 0;
+                $businessGainIntegral = isset($cart['productInfo']['business_integral']) ? bcmul($cart['cart_num'], $cart['productInfo']['business_integral'], 2) : 0;
+                $gainIntegral = bcadd($gainIntegral, $cartInfoGainIntegral, 2);
+                $whiteIntegral = bcadd($whiteIntegral, $whiteInfoGainIntegral, 2);
+                $businessIntegral = bcadd($businessIntegral, $businessGainIntegral, 2);
+                $price = $cart['productInfo']['price'];
+            }
+            $orderInfo = [
+                'uid' => $request->uid(),
+                'order_id' => StoreOrder::getNewOrderId(),
+                'real_name' => $user_add['real_name'],
+                'user_phone' => $user_add['phone'],
+                'user_address' => $user_add['province'] . ' ' . $user_add['city'] . ' ' . $user_add['district'] . ' ' . $user_add['detail'],
+                'cart_id' => $cartIds,
+                'total_num' => $totalNum,
+                'total_price' => $price,
+                'total_postage' => 0,
+                'coupon_id' => 0,
+                'coupon_price' => 0,
+                'pay_price' => 0,
+                'pay_postage' => 0,
+                'deduction_price' => 0,
+                'paid' => 1,
+                'pay_type' => 'integral',
+                'use_integral' => $luck['price'],
+                'gain_integral' => 0,
+                'white_integral' => 0,
+                'business_integral' => 0,
+                'remark' => '新人专享中奖商品',
+                'mark' => '',
+                'combination_id' => 0,
+                'pink_id' => 0,
+                'freight_price' => 0,
+                'cumulative' => 0,
+                'pay_time' => time(),
+                'add_time' => time(),
+                'unique' => md5(rand(1, 100000).$request->uid()),
+                'refund_price' => 0,
+                'cost' => $products['cost'],
+            ];
+            $order = StoreOrder::create($orderInfo);
+            $res4 = StoreOrderCartInfo::setCartInfo($order['id'], $cartInfo);
+            $res6 = StoreCart::where('id', 'IN', $cartIds)->update(['is_pay' => 1]);
+            $res2 = StoreOrderStatus::status($order['id'], 'cache_key_create_order', '订单生成');
+            $res3 = User::where('uid', $request->uid())->dec('white_integral', $luck['price'])->update();
+            UserBill::expend('新人专享抽奖', $request->uid(), 'white_integral', 'xr_white_integral', $luck['price'], '', $user['white_integral']-$luck['price'], '新人专享筹抽奖');
+            $res = LuckOrder::create([
+                'luck_id' => 1,
+                'uid' => $request->uid(),
+                'price' => $luck['price'],
+                'status' => 1,
+                'state' => 1,
+            ]);
+            if ($order and $res4 and $res6 and $res2 and $res and $res3){
+                Db::commit();
+                return app('json')->success('中奖啦', ['product' => $products['id']]);
+            }else{
+                Db::rollback();
+                return app('json')->success('抽奖失败');
+            }
+        }
+        return app('json')->success('抽奖失败');
+    }
+
+
+
+
+
+}

+ 16 - 13
app/api/controller/many/ManyController.php

@@ -75,21 +75,23 @@ class ManyController
             ['id'],
             ['price']
         ]);
-        $many = Many::where('id', $data['id'])->find();
+        Db::startTrans();
+        $many = Many::where('id', $data['id'])->lock(true)->find();
         $surplus = $this->surplus($data['id'], $request->uid(),1);
         $user = User::where('uid', $request->uid())->find();
-        if ($data['price'] < 10) return app('json')->fail('最小投注数10');
+        if ($user['blacklist'] < 1) return app('json')->fail('种植失败');
+        if ($data['price'] < $many['lower_limit']) return app('json')->fail('最小种植数'.$many['lower_limit']);
         if (!$many) return app('json')->fail('场次不存在');
-        if ($many['number'] >= $many['money']) return app('json')->fail('已完成无法投注');
+        if ($many['number'] >= $many['money']) return app('json')->fail('已完成无法种植');
         if ($many['status'] == 0) return app('json')->fail('未开启');
         if ($many['end_time'] < time()) return app('json')->fail('已结束');
-        if (($many['number']+$data['price']) > $many['money']) return app('json')->fail('还能最大投注'.($many['money']-$many['number']));
-        if ($data['price'] > $many['single']) return app('json')->fail('单次最大可打怪'.$many['single']);
-        if ($surplus < $data['price']) return app('json')->fail('超过最大可投注额度');
-        Db::startTrans();
+        if (($many['number']+$data['price']) > $many['money']) return app('json')->fail('还能最大种植'.($many['money']-$many['number']));
+        if ($data['price'] > $many['single']) return app('json')->fail('单次最大可种植'.$many['single']);
+        if ($surplus < $data['price']) return app('json')->fail('超过最大可种植额度');
+
         if ($many['add_time'] > time()){
             $green = ManyGreen::where('uid', $user['uid'])->where('status', 0)->find();
-            if (!$green) return app('json')->fail('你无法提前打怪');
+            if (!$green) return app('json')->fail('你无法提前种植');
             $green['status'] = 1;
         }
         $integral = $user['white_integral'] + $user['purple_integral'];// 白积分加紫积分的总积分
@@ -99,18 +101,18 @@ class ManyController
                 $white = $user['white_integral'];
                 if ($white > 0){
                     User::where('uid', $request->uid())->dec('white_integral',$white)->update();
-                    UserBill::expend('扣除红积分', $user['uid'], 'white_integral', 'bet_white_integral', $white, 0,0,'使用红积分,参与打怪-》'.$many['name'].'期数-》'.$many['stage'].'-成功');
+                    UserBill::expend('扣除红积分', $user['uid'], 'white_integral', 'bet_white_integral', $white, 0,0,'使用红积分,参与种植-》'.$many['name'].'期数-》'.$many['stage'].'-成功');
                 }
                 $user['purple_integral'] -= $data['price'] - $white;
                 User::where('uid', $request->uid())->dec('purple_integral', $data['price']-$white)->update();
-                UserBill::expend('扣除阳光积分', $user['uid'], 'purple_integral', 'bet_purple_integral', $data['price']-$white, 0,$user['purple_integral'],'使用阳光积分,参与打怪-》'.$many['name'].'期数-》'.$many['stage'].'-成功');
+                UserBill::expend('扣除阳光积分', $user['uid'], 'purple_integral', 'bet_purple_integral', $data['price']-$white, 0,$user['purple_integral'],'使用阳光积分,参与种植-》'.$many['name'].'期数-》'.$many['stage'].'-成功');
             }else{
                 $user['white_integral'] -= $data['price'];
                 User::where('uid', $request->uid())->dec('white_integral', $data['price'])->update();
-                UserBill::expend('扣除红积分', $user['uid'], 'white_integral', 'bet_white_integral', $data['price'], 0,$user['white_integral'],'使用红积分,参与打怪-》'.$many['name'].'期数-》'.$many['stage'].'-成功');
+                UserBill::expend('扣除红积分', $user['uid'], 'white_integral', 'bet_white_integral', $data['price'], 0,$user['white_integral'],'使用红积分,参与种植-》'.$many['name'].'期数-》'.$many['stage'].'-成功');
             }
-            $many['number'] += $data['price'];
-            if ($many['number'] >= $many['money']){
+            $number = $many['number'] + $data['price'];
+            if ($number >= $many['money']){
                 $many['suc'] = 1;// 众筹成功
                 $many['status'] = 0;// 众筹成功
                 ManyDiscipline::create(['many_id' => $many['id'], 'stage' => $many['stage'], 'status' => 1]);// 成功记录
@@ -127,6 +129,7 @@ class ManyController
                 'stage' => $many['stage'],
                 'price' => $data['price'],
             ]);
+            Many::where('id', $data['id'])->inc('number', $data['price'])->update();
             $many->save();
             if ($many['add_time'] > time()) $green->save();
             event('Many', ['many' => $many, 'data' => $data, 'uid' => $request->uid()]);

+ 4 - 3
app/api/controller/order/StoreOrderController.php

@@ -51,6 +51,7 @@ class StoreOrderController
         if (!is_string($cartId) || !$cartId) return app('json')->fail('请提交购买的商品');
         $uid = $request->uid();
         $cartGroup = StoreCart::getUserProductCartList($uid, $cartId, 1);
+
         if (count($cartGroup['invalid'])) return app('json')->fail($cartGroup['invalid'][0]['productInfo']['store_name'] . '已失效!');
         if (!$cartGroup['valid']) return app('json')->fail('请提交购买的商品');
         $cartInfo = $cartGroup['valid'];
@@ -198,7 +199,7 @@ class StoreOrderController
                     $orderInfo = StoreOrder::where('order_id', $orderId)->find();
                     if (!$orderInfo || !isset($orderInfo['paid'])) return app('json')->fail('支付订单不存在!');
                     $orderInfo = $orderInfo->toArray();
-                    if ($orderInfo['paid']) return app('json')->fail('支付已支付!');
+//                    if ($orderInfo['paid']) return app('json')->fail('支付已支付!');
                     //支付金额为0
                     if (bcsub((float)$orderInfo['pay_price'], 0, 2) <= 0) {
                         //创建订单jspay支付
@@ -317,8 +318,8 @@ class StoreOrderController
         $order = StoreOrder::getUserOrderDetail($request->uid(), $uni);
         if (!$order)
             return app('json')->fail('订单不存在!');
-        if ($order['paid'])
-            return app('json')->fail('该订单已支付!');
+//        if ($order['paid'])
+//            return app('json')->fail('该订单已支付!');
         if ($order['pink_id']) if (StorePink::isPinkStatus($order['pink_id']))
             return app('json')->fail('该订单已失效!');
 

+ 80 - 3
app/api/controller/user/UserController.php

@@ -7,6 +7,7 @@ use app\models\many\ManyOrder;
 use app\models\system\SystemCity;
 use app\models\user\UserEnter;
 use app\models\user\UserVisit;
+use app\models\user\WechatUser;
 use think\db\exception\DataNotFoundException;
 use think\db\exception\DbException;
 use think\db\exception\ModelNotFoundException;
@@ -27,6 +28,7 @@ use app\models\user\UserExtract;
 use app\models\user\UserNotice;
 use crmeb\services\GroupDataService;
 use crmeb\services\UtilService;
+use think\facade\Db;
 
 /**
  * 用户类
@@ -710,8 +712,10 @@ class UserController
         $data = [
             'count' => 0,
             'user_list' => [],
-            'user_price' => 0
+            'user_price' => 0,
+            'week_price' => 0
         ];
+        $week = date('w');
         if (count($userId) > 0){
             $count = count($userId);
             $userList = User::where('uid', 'in', $userId)
@@ -721,13 +725,19 @@ class UserController
                 $item['zt'] = 0;
                 $item['phone'] = substr_replace($item['phone'], '****', 3, 4);
                 if ($item['spread_uid'] == $request->uid()) $item['zt'] = 1;
-                $item['price'] =  ManyOrder::where('uid', $item['uid'])->where('status', 1)->sum('price');
+                $item['price'] =  ManyOrder::where('uid', $item['uid'])->where('status', 1)->sum('price');//返回额度
+                $item['cy_price'] = ManyOrder::where('uid', $item['uid'])->where('status', 0)->where('is_return', 0)->sum('price'); // 参与中金额
+                $item['dfh_price'] = ManyOrder::where('uid', $item['uid'])->where('status', 0)->where('is_return', 1)->sum('price'); // 待返回金额
+                $item['ztr_price'] = ManyOrder::where('uid', $item['uid'])->sum('price'); // 总投注额度
+                $item['order_price'] = StoreOrder::where('uid', $item['uid'])->where('paid', 1)->sum('pay_price');
             }
             $userPrice = ManyOrder::where('uid', 'in', $userId)->where('status', 1)->sum('price');
+            $weekPrice = ManyOrder::where('uid', 'in', $userId)->whereBetweenTime('create_time', strtotime(date('Y-m-d',strtotime( '+'. 1-$week .' days' ))), strtotime(date('Y-m-d',strtotime( '+'. 7-$week .' days' ))))->sum('price');
             $data = [
                 'count' => $count,
                 'user_price' => $userPrice,
-                'user_list' => $userList,
+                'week_price' => $weekPrice,
+                'user_list' => $userList
             ];
         }
         return app('json')->success($data);
@@ -784,4 +794,71 @@ class UserController
         $notice = empty($notice)?[]:$notice->toArray();
         return app('json')->success($notice);
     }
+
+
+    /**
+     * 会员紧缩
+     * @return void
+     * @throws DataNotFoundException
+     * @throws DbException
+     * @throws ModelNotFoundException
+     */
+    public function tighten()
+    {
+        $user = User::select();
+        foreach ($user as $item)
+        {
+            $time = time() - $item['add_time'];
+            if ($time > (86400*30)){
+                $many_order = ManyOrder::where('uid', $item['uid'])->whereBetweenTime('create_time', strtotime('-30 day'), time())->count();
+                if ($many_order == 0){
+                    User::where('spread_uid', $item['uid'])->update(['spread_uid' => $item['spread_uid']]);
+                    User::where('uid', $item['uid'])->delete();
+                    WechatUser::where('uid', $item['uid'])->delete();
+                }
+            }
+        }
+        return app('json')->success('成功');
+    }
+
+    /**
+     * @param Request $request
+     * @return mixed
+     * @throws DataNotFoundException
+     * @throws DbException
+     * @throws ModelNotFoundException
+     */
+    public function turn(Request $request)
+    {
+        $data = UtilService::postMore([
+            ['price', 0],
+            ['uid', 0]
+        ]);
+        if ($data['price'] <= 0) return app('json')->fail('请输入转账额度');
+        if ($data['uid'] <= 0) return app('json')->fail('请输入转账人手机号或者编号');
+        $id = $request->uid();
+        $user = User::where('uid', $id)->find(); // 转账人
+        $user_e = User::where('uid|phone', $data['uid'])->find(); // 收转人
+        if ($user['purple_integral'] < $data['price']) return app('json')->fail('转账积分不足');
+        if (!$user_e) return app('json')->fail('转账用户不存在');
+        $userList = User::select()->toArray();
+        $top = getParent($user['spread_uid'], $userList);
+        $lower = get_downline_dow($userList, $user['uid']);
+        $spread = array_merge($top, $lower);
+        if (!in_array($user_e['uid'],$spread)) return app('json')->fail('该用户不是你的同一条线');
+
+        try {
+            Db::startTrans();
+            User::where('uid', $user['uid'])->dec('purple_integral', $data['price'])->update();
+            User::where('uid', $user_e['uid'])->inc('purple_integral', $data['price'])->update();
+            UserBill::expend('转账阳光积分', $user['uid'], 'purple_integral', 'turn_purple_integral', $data['price'], $user_e['uid'], $user['purple_integral']-$data['price'], '转账给用户'.$user_e['account'].'阳光积分');
+            UserBill::income('接收阳光积分', $user_e['uid'], 'purple_integral', 'jies_purple_integral', $data['price'], $user['uid'], $user_e['purple_integral']+$data['price'], '接收用户'.$user['account'].'阳光积分');
+            Db::commit();
+            return app('json')->success('转账成功');
+        } catch (\Exception $e) {
+            Db::rollback();
+            return app('json')->success('操作失败');
+        }
+
+    }
 }

+ 2 - 0
app/api/controller/user/UserExtractController.php

@@ -70,6 +70,8 @@ class UserExtractController
             ['weixin', ''],
         ], $request);
         if ($extractInfo['money'] < 50) return app('json')->fail('最少提现50');
+        $extract = UserExtract::where('uid', $request->uid())->where('status', '<', 0)->whereBetweenTime('add_time', strtotime('today'), strtotime('tomorrow'))->count();
+        if ($extract >= 3) return app('json')->fail('今天提现错误3次,请明天再提现');
         if (cache($request->uid())) return app('json')->fail('请勿频繁点击');
         if (!preg_match('/^\\d+(\\.\\d+)?$/', $extractInfo['money'])) return app('json')->fail('提现金额输入有误');
         $user = $request->user();

+ 19 - 1
app/common.php

@@ -697,7 +697,7 @@ if (!function_exists('do_request')) {
     }
 
     if (!function_exists('sing')){
-        //查找所有上级
+        //sing
         function sing($data, $key){
             ksort($data);
             $stringToBeSigned = "";
@@ -712,5 +712,23 @@ if (!function_exists('do_request')) {
         }
     }
 
+    function get_rand($proArr) {
+        $result = '';
+        //概率数组的总概率精度
+        $proSum = array_sum($proArr); //计算数组中元素的和
+        //概率数组循环
+        foreach ($proArr as $key => $proCur) {
+            $randNum = mt_rand(1, $proSum);
+            if ($randNum <= $proCur) { //如果这个随机数小于等于数组中的一个元素,则返回数组的下标
+                $result = $key;
+                break;
+            } else {
+                $proSum -= $proCur;
+            }
+        }
+        unset ($proArr);
+        return $result;
+    }
+
 
 }

+ 37 - 29
app/http/middleware/AllowOriginMiddleware.php

@@ -56,35 +56,43 @@ class AllowOriginMiddleware implements MiddlewareInterface
         } else {
             $response = $next($request)->header($header);
         }
-        try {
-            Db::startTrans();
-            User::agent();//区域代理发放
-            Db::commit();
-        } catch (\Exception $e) {
-            Db::rollback();
-        }
-        try {
-            Db::startTrans();
-            ManyOrder::flowing_water(); //流水分红
-            Db::commit();
-        } catch (\Exception $e) {
-            Db::rollback();
-        }
-        try {
-            Db::startTrans();
-            Many::fail();//众筹失败
-            Db::commit();
-        } catch (\Exception $e) {
-            Db::rollback();
-        }
-        try {
-            Db::startTrans();
-            ManyOrder::suc_return(); // 众筹成功订单返还
-            Db::commit();
-        } catch (\Exception $e) {
-            Db::rollback();
-        }
-        ManyOrder::time(); //流水分红
+
+//        try {
+//            Db::startTrans();
+//            User::agent();//区域代理发放
+//            Db::commit();
+//        } catch (\Exception $e) {
+//            Db::rollback();
+//        }
+//        try {
+//            Db::startTrans();
+//            ManyOrder::flowing_water(); //流水分红
+//            Db::commit();
+//        } catch (\Exception $e) {
+//            Db::rollback();
+//        }
+//        try {
+//            Db::startTrans();
+//            Many::fail();//众筹失败
+//            Db::commit();
+//        } catch (\Exception $e) {
+//            Db::rollback();
+//        }
+//        try {
+//            Db::startTrans();
+//            ManyOrder::suc_return(); // 众筹成功订单返还
+//            Db::commit();
+//        } catch (\Exception $e) {
+//            Db::rollback();
+//        }
+//        try {
+//            Db::startTrans();
+//            ManyOrder::push(); // 团队奖励
+//            Db::commit();
+//        } catch (\Exception $e) {
+//            Db::rollback();
+//        }
+//        ManyOrder::time(); //流水分红
 
         $request->filter(['htmlspecialchars', 'strip_tags', 'addslashes', 'trim']);
         return $response;

+ 5 - 5
app/models/many/Many.php

@@ -80,7 +80,7 @@ class Many extends BaseModel
                         $user = User::where('uid', $value['uid'])->find();
                         $user['white_integral'] += $value['price'] * 1.01;// 返还
                         $user->save();
-                        UserBill::income('打怪失败返还红积分', $value['uid'], 'white_integral', 'sbfh_white_integral', $value['price'] * 1.01, 0, $user['white_integral'], '打怪失败返还' . $item['name'] . '-第' . $value['stage'] . '期红积分');
+                        UserBill::income('种植失败返还红积分', $value['uid'], 'white_integral', 'sbfh_white_integral', $value['price'] * 1.01, 0, $user['white_integral'], '打怪失败返还' . $item['name'] . '-第' . $value['stage'] . '期红积分');
                     }
                     if ($order) {
                         foreach ($order as $value) {
@@ -90,10 +90,10 @@ class Many extends BaseModel
                             $user['paper_ticket'] += $value['price'] * 0.3;// 返还百分之三十的文票
                             $user['integral'] += $value['price'] * 0.3;// 返还百分之三十的商城积分
                             $user->save();
-                            UserBill::income('打怪失败返还红积分', $value['uid'], 'white_integral', 'sbfh_white_integral', $value['price'] * 0.7, 0, $user['white_integral'], '打怪失败返还' . $item['name'] . '-第' . $value['stage'] . '期红积分');
-                            UserBill::income('打怪失败返还绿积分', $value['uid'], 'green', 'sbfh_green', $value['price'] * 0.3, 0, $user['green_integral'], '打怪失败返还' . $item['name'] . '-第' . $value['stage'] . '期绿积分');
-                            UserBill::income('打怪失败返还文票', $value['uid'], 'paper_ticket', 'sbfh_paper_ticket', $value['price'] * 0.3, 0, $user['paper_ticket'], '打怪失败返还' . $item['name'] . '-第' . $value['stage'] . '期文票');
-                            UserBill::income('打怪失败返还商城积分', $value['uid'], 'integral', 'sbfh_integral', $value['price'] * 0.3, 0, $user['integral'], '打怪失败返还' . $item['name'] . '-第' . $value['stage'] . '期商城积分');
+                            UserBill::income('种植失败返还红积分', $value['uid'], 'white_integral', 'sbfh_white_integral', $value['price'] * 0.7, 0, $user['white_integral'], '种植失败返还' . $item['name'] . '-第' . $value['stage'] . '期红积分');
+                            UserBill::income('种植失败返还绿积分', $value['uid'], 'green', 'sbfh_green', $value['price'] * 0.3, 0, $user['green_integral'], '种植失败返还' . $item['name'] . '-第' . $value['stage'] . '期绿积分');
+                            UserBill::income('种植失败返还文票', $value['uid'], 'paper_ticket', 'sbfh_paper_ticket', $value['price'] * 0.3, 0, $user['paper_ticket'], '种植失败返还' . $item['name'] . '-第' . $value['stage'] . '期文票');
+                            UserBill::income('种植失败返还商城积分', $value['uid'], 'integral', 'sbfh_integral', $value['price'] * 0.3, 0, $user['integral'], '种植失败返还' . $item['name'] . '-第' . $value['stage'] . '期商城积分');
                         }
                     }
                     ManyOrder::where('many_id', '=', $item['id'])->where('stage', 'in', [$item['stage'] - 3, $item['stage'], $item['stage'] - 2, $item['stage'] - 1])->update(['status' => 2]);

+ 125 - 109
app/models/many/ManyOrder.php

@@ -84,7 +84,6 @@ class ManyOrder extends BaseModel
                     $business_integral = round($item['price'] * 0.0006, 2);// 奖励商家积分
                     $user['purple_integral'] += $purple_integral;
                     $user['business_integral'] += $business_integral;
-                    ManyOrder::push($item['uid'], $item);
                     if ($user['spread_uid'] > 0){
                         $user1 = User::where('uid', $user['spread_uid'])->find();//用户
                         if ($user1['spread_uid'] > 0) $user2 = User::where('uid', $user1['spread_uid'])->find();//用户
@@ -104,8 +103,8 @@ class ManyOrder extends BaseModel
                     self::where('id', $item['id'])->update(['status' => 1, 'return_time' => time()]);
                     User::where('uid', $item['uid'])->inc('purple_integral', $purple_integral)->update();
                     User::where('uid', $item['uid'])->inc('business_integral', $business_integral)->update();
-                    UserBill::income('打怪胜利补贴阳光积分', $user['uid'], 'purple_integral', 'zccg_purple_integral', $purple_integral, $user['spread_uid'], $user['purple_integral'], '打怪胜利补贴'.$many['name'].'-第'.$item['stage'].'期阳光积分');
-                    UserBill::income('打怪胜利补贴美好积分', $user['uid'], 'business_integral', 'zccg_business_integral', $business_integral, $user['spread_uid'], $user['integral'], '打怪胜利补贴'.$many['name'].'-第'.$item['stage'].'期美好积分');
+                    UserBill::income('种植胜利补贴阳光积分', $user['uid'], 'purple_integral', 'zccg_purple_integral', $purple_integral, $user['spread_uid'], $user['purple_integral'], '种植胜利补贴'.$many['name'].'-第'.$item['stage'].'期阳光积分');
+                    UserBill::income('种植胜利补贴美好积分', $user['uid'], 'business_integral', 'zccg_business_integral', $business_integral, $user['spread_uid'], $user['integral'], '种植胜利补贴'.$many['name'].'-第'.$item['stage'].'期美好积分');
                     if ($user1){
                         UserBill::income('直推奖励阳光积分', $user1['uid'], 'purple_integral', 'zt_purple_integral', $sy1*0.7, $user1['spread_uid'], $user1['purple_integral'], '直推奖励阳光积分');
                         UserBill::income('直推奖励美好积分', $user1['uid'], 'business_integral', 'zt_business_integral', $sy1*0.0006, $user1['spread_uid'], $user1['integral'], '直推奖励美好积分');
@@ -132,118 +131,135 @@ class ManyOrder extends BaseModel
      * @throws \think\db\exception\DbException
      * @throws \think\db\exception\ModelNotFoundException
      */
-    public static function push($uid, $order)
+    public static function push()
     {
-        $user = User::select();
-        $find = User::where('uid', $uid)->find();
-        $many = Many::where('id', $order['many_id'])->find();
-        $price = $order['price'];
-        if ($find['spread_uid'] > 0 and $price > 0){
-            $spread = getParent($uid, $user->toArray());// 找到所有上级
-            $v1 = 0;
-            $v2 = 0;
-            $v3 = 0;
-            $one = SystemConfig::getConfigValue('v1')/100; // v1比例
-            $tow = SystemConfig::getConfigValue('v2')/100;// v2比例
-            $three = SystemConfig::getConfigValue('v3')/100;// v3比例
-            foreach ($spread as $value) {
-                $details = User::where('uid', $value)->find();
-                if ($details['level'] == 1){
-                    if ($v2 == 0 and $v3 == 0){
-                        // 没有发放v2和v3的奖励
-                        if ($v1 == 0) { // 没有发放v1的奖励
-                            $jl = $price * $one;
-                            $details['purple_integral'] += $jl * 0.7; // 百分之70的紫积分
-                            $details['business_integral'] += $jl * 0.0006; // 百分之30的商家积分
-                            $v1++;
-                        }elseif ($v1 == 1){// 发放v1奖励1次
-                            $jl = ($price*$one)*0.03;//平级的百分之五
-                            $details['purple_integral'] += $jl * 0.7; // 百分之70的紫积分
-                            $details['business_integral'] += $jl * 0.0006; // 百分之30的商家积分
-                            $v1++;
-                        }
-                    }
-                }elseif ($details['level'] == 2){
-                    if ($v3 == 0){
-                        // 没有发放v3的奖励
-                        if ($v1 == 0 and $v2 == 0) { // 没有发放v1和v2的奖励的奖励
-                            $jl = $price * $tow; // 拿到流水的百分之八
-                            $details['purple_integral'] += $jl * 0.7; // 百分之70的紫积分
-                            $details['business_integral'] += $jl * 0.3; // 百分之30的商家积分
-                            $v2++;
-                        }elseif($v1 == 0 and $v2 == 1) { // 没有发放v1和v2的奖励的奖励
-                            $jl = ($price * $tow)*0.03; // 拿到流水的百分之八
-                            $details['purple_integral'] += $jl * 0.7; // 百分之70的紫积分
-                            $details['business_integral'] += $jl * 0.0006; // 百分之30的商家积分
-                            $v2++;
-                        }elseif ($v1 > 0 and $v2 == 0){// 发放v1奖励,没有发放v2的奖励
-                            $jl = $price * ($tow - $one); // 拿到流水减掉v1的百分之五
-                            $details['purple_integral'] += $jl * 0.7; // 百分之70的紫积分
-                            $details['business_integral'] += $jl * 0.0006; // 百分之30的商家积分
-                            $v2++;
-                        }elseif ($v1 > 0 and $v2 == 1){// 发放v1奖励,发放v2的奖励一次
-                            $jl = ($price * ($tow - $one))*0.03; // 拿到平级的百分之五
-                            $details['purple_integral'] += $jl * 0.7; // 百分之70的紫积分
-                            $details['business_integral'] += $jl * 0.0006; // 百分之30的商家积分
-                            $v2++;
-                        }
+        if (time() >= strtotime(date('Y-m-d 15:00:00')) and !Push::where('type', 1)->where('add_time', strtotime('today'))->find())
+        {
+            $user = User::select();
+            foreach ($user as $k => $v)
+            {
+                if ($v['spread_uid'] > 0){
+                    $manyOrder = ManyOrder::where('uid', $v['uid'])->where('is_return', 1)->whereBetweenTime('return_time', strtotime('today'), strtotime('tomorrow'))->select();
+                    if ($manyOrder){
+                        foreach ($manyOrder as $item)
+                        {
+                            $price = $item['price'];
+                            $spread = getParent($v['spread_uid'], $user->toArray());// 找到所有上级
+                            $v1 = 0;
+                            $v2 = 0;
+                            $v3 = 0;
+                            $one = SystemConfig::getConfigValue('v1')/100; // v1比例
+                            $tow = SystemConfig::getConfigValue('v2')/100;// v2比例
+                            $three = SystemConfig::getConfigValue('v3')/100;// v3比例
+                            foreach ($spread as $value) {
+                                $spreadOrder = ManyOrder::where('uid', $value)->whereBetweenTime('create_time', strtotime('today'), strtotime('tomorrow'))->count();
+                                if ($spreadOrder > 0){
+                                    $details = User::where('uid', $value)->find();
+                                    if ($details['level'] == 1){
+                                        if ($v2 == 0 and $v3 == 0){
+                                            // 没有发放v2和v3的奖励
+                                            if ($v1 == 0) { // 没有发放v1的奖励
+                                                $jl = $price * $one;
+                                                $details['purple_integral'] += $jl * 0.7; // 百分之70的紫积分
+                                                $details['business_integral'] += $jl * 0.0006; // 百分之30的商家积分
+                                                $v1++;
+                                            }elseif ($v1 == 1){// 发放v1奖励1次
+                                                $jl = ($price*$one)*0.03;//平级的百分之五
+                                                $details['purple_integral'] += $jl * 0.7; // 百分之70的紫积分
+                                                $details['business_integral'] += $jl * 0.0006; // 百分之30的商家积分
+                                                $v1++;
+                                            }
+                                        }
+                                    }elseif ($details['level'] == 2){
+                                        if ($v3 == 0){
+                                            // 没有发放v3的奖励
+                                            if ($v1 == 0 and $v2 == 0) { // 没有发放v1和v2的奖励的奖励
+                                                $jl = $price * $tow; // 拿到流水的百分之八
+                                                $details['purple_integral'] += $jl * 0.7; // 百分之70的紫积分
+                                                $details['business_integral'] += $jl * 0.3; // 百分之30的商家积分
+                                                $v2++;
+                                            }elseif($v1 == 0 and $v2 == 1) { // 没有发放v1和v2的奖励的奖励
+                                                $jl = ($price * $tow)*0.03; // 拿到流水的百分之八
+                                                $details['purple_integral'] += $jl * 0.7; // 百分之70的紫积分
+                                                $details['business_integral'] += $jl * 0.0006; // 百分之30的商家积分
+                                                $v2++;
+                                            }elseif ($v1 > 0 and $v2 == 0){// 发放v1奖励,没有发放v2的奖励
+                                                $jl = $price * ($tow - $one); // 拿到流水减掉v1的百分之五
+                                                $details['purple_integral'] += $jl * 0.7; // 百分之70的紫积分
+                                                $details['business_integral'] += $jl * 0.0006; // 百分之30的商家积分
+                                                $v2++;
+                                            }elseif ($v1 > 0 and $v2 == 1){// 发放v1奖励,发放v2的奖励一次
+                                                $jl = ($price * ($tow - $one))*0.03; // 拿到平级的百分之五
+                                                $details['purple_integral'] += $jl * 0.7; // 百分之70的紫积分
+                                                $details['business_integral'] += $jl * 0.0006; // 百分之30的商家积分
+                                                $v2++;
+                                            }
 
-                    }
+                                        }
+
+                                    }elseif ($details['level'] == 3){
+                                        if ($v1 == 0 and $v2 == 0 and $v3 == 0) { // 没有发放v1和v2v3的奖励的奖励
+                                            $jl = $price * $three; // 拿到流水的百分之11
+                                            $details['purple_integral'] += $jl * 0.7; // 百分之70的紫积分
+                                            $details['business_integral'] += $jl * 0.0006; // 百分之30的商家积分
+                                            $v3++;
+                                        }elseif ($v1 == 0 and $v2 == 0 and $v3 == 1) {// 没有发放v1和v2的奖励的奖励
+                                            $jl = ($price * $three) * 0.03; // 拿到平级的百分之五
+                                            $details['purple_integral'] += $jl * 0.7; // 百分之70的紫积分
+                                            $details['business_integral'] += $jl * 0.0006; // 百分之30的商家积分
+                                            $v3++;
+                                        }elseif ($v1 > 0 and $v2 == 0 and $v3 == 0){// 发放v1奖励,没有发放v2v3的奖励
+                                            $jl = $price * ($three - $one); // 拿到流水减掉v1的百分之五
+                                            $details['purple_integral'] += $jl * 0.7; // 百分之70的紫积分
+                                            $details['business_integral'] += $jl * 0.0006; // 百分之30的商家积分
+                                            $v3++;
+                                        }elseif ($v1 > 0 and $v2 == 0 and $v3 == 1){// 发放v1奖励,没有发放v2v3的奖励
+                                            $jl = ($price * ($three - $one)) * 0.05; // 拿到平级的百分之五
+                                            $details['purple_integral'] += $jl * 0.7; // 百分之70的紫积分
+                                            $details['business_integral'] += $jl * 0.0006; // 百分之30的商家积分
+                                            $v3++;
+                                        }elseif ($v1 == 0 and $v2 > 0 and $v3 == 0){// 发放v1奖励,发放v2的奖励,没有发放v3的奖励
+                                            $jl = ($price * ($three - $tow)); // 拿到平级的百分之五
+                                            $details['purple_integral'] += $jl * 0.7; // 百分之70的紫积分
+                                            $details['business_integral'] += $jl * 0.0006; // 百分之30的商家积分
+                                            $v3++;
+                                        }elseif ($v1 == 0 and $v2 > 0 and $v3 == 1){// 发放v1奖励,发放v2的奖励,发放v3的奖励
+                                            $jl = ($price * ($three - $tow)) * 0.03; // 拿到平级的百分之五
+                                            $details['purple_integral'] += $jl * 0.7; // 百分之70的紫积分
+                                            $details['business_integral'] += $jl * 0.0006; // 百分之30的商家积分
+                                            $v3++;
+                                        }elseif ($v1 > 0 and $v2 > 0 and $v3 == 0){// 发放v1奖励,发放v2的奖励,发放v3的奖励
+                                            $jl = ($price * ($three - $tow)); // 拿到平级的百分之五
+                                            $details['purple_integral'] += $jl * 0.7; // 百分之70的紫积分
+                                            $details['business_integral'] += $jl * 0.0006; // 百分之30的商家积分
+                                            $v3++;
+                                        }elseif ($v1 > 0 and $v2 > 0 and $v3 == 1){// 发放v1奖励,发放v2的奖励,发放v3的奖励
+                                            $jl = ($price * ($three - $tow)) * 0.03; // 拿到平级的百分之五
+                                            $details['purple_integral'] += $jl * 0.7; // 百分之70的紫积分
+                                            $details['business_integral'] += $jl * 0.0006; // 百分之30的商家积分
+                                            $v3++;
+                                        }
+                                    }else{
+                                        $jl = 0;
+                                    }
+                                    if ($jl > 0){
+                                        User::where('uid', $value)->inc('purple_integral', $jl * 0.7)->update();
+                                        User::where('uid', $value)->inc('business_integral', $jl * 0.0006)->update();
+                                        UserBill::income('团队奖励阳光积分', $details['uid'], 'purple_integral', 'td_purple_integral', $jl * 0.7, 0,$details['purple_integral'], '打怪胜利补贴'.$item['name'].'-第'.$item['stage'].'期团队v'.$details['level'].'奖励阳光积分');
+                                        UserBill::income('团队奖励美好积分', $details['uid'], 'business_integral', 'td_business_integral', $jl * 0.0006, 0,$details['integral'], '打怪胜利补贴'.$item['name'].'-第'.$item['stage'].'期期团队v'.$details['level'].'奖励美好积分');
+                                    }
+                                    $jl = 0;
+                                }
+                            }
+                        }
 
-                }elseif ($details['level'] == 3){
-                    if ($v1 == 0 and $v2 == 0 and $v3 == 0) { // 没有发放v1和v2v3的奖励的奖励
-                        $jl = $price * $three; // 拿到流水的百分之11
-                        $details['purple_integral'] += $jl * 0.7; // 百分之70的紫积分
-                        $details['business_integral'] += $jl * 0.0006; // 百分之30的商家积分
-                        $v3++;
-                    }elseif ($v1 == 0 and $v2 == 0 and $v3 == 1) {// 没有发放v1和v2的奖励的奖励
-                        $jl = ($price * $three) * 0.03; // 拿到平级的百分之五
-                        $details['purple_integral'] += $jl * 0.7; // 百分之70的紫积分
-                        $details['business_integral'] += $jl * 0.0006; // 百分之30的商家积分
-                        $v3++;
-                    }elseif ($v1 > 0 and $v2 == 0 and $v3 == 0){// 发放v1奖励,没有发放v2v3的奖励
-                        $jl = $price * ($three - $one); // 拿到流水减掉v1的百分之五
-                        $details['purple_integral'] += $jl * 0.7; // 百分之70的紫积分
-                        $details['business_integral'] += $jl * 0.0006; // 百分之30的商家积分
-                        $v3++;
-                    }elseif ($v1 > 0 and $v2 == 0 and $v3 == 1){// 发放v1奖励,没有发放v2v3的奖励
-                        $jl = ($price * ($three - $one)) * 0.05; // 拿到平级的百分之五
-                        $details['purple_integral'] += $jl * 0.7; // 百分之70的紫积分
-                        $details['business_integral'] += $jl * 0.0006; // 百分之30的商家积分
-                        $v3++;
-                    }elseif ($v1 == 0 and $v2 > 0 and $v3 == 0){// 发放v1奖励,发放v2的奖励,没有发放v3的奖励
-                        $jl = ($price * ($three - $tow)); // 拿到平级的百分之五
-                        $details['purple_integral'] += $jl * 0.7; // 百分之70的紫积分
-                        $details['business_integral'] += $jl * 0.0006; // 百分之30的商家积分
-                        $v3++;
-                    }elseif ($v1 == 0 and $v2 > 0 and $v3 == 1){// 发放v1奖励,发放v2的奖励,发放v3的奖励
-                        $jl = ($price * ($three - $tow)) * 0.03; // 拿到平级的百分之五
-                        $details['purple_integral'] += $jl * 0.7; // 百分之70的紫积分
-                        $details['business_integral'] += $jl * 0.0006; // 百分之30的商家积分
-                        $v3++;
-                    }elseif ($v1 > 0 and $v2 > 0 and $v3 == 0){// 发放v1奖励,发放v2的奖励,发放v3的奖励
-                        $jl = ($price * ($three - $tow)); // 拿到平级的百分之五
-                        $details['purple_integral'] += $jl * 0.7; // 百分之70的紫积分
-                        $details['business_integral'] += $jl * 0.0006; // 百分之30的商家积分
-                        $v3++;
-                    }elseif ($v1 > 0 and $v2 > 0 and $v3 == 1){// 发放v1奖励,发放v2的奖励,发放v3的奖励
-                        $jl = ($price * ($three - $tow)) * 0.03; // 拿到平级的百分之五
-                        $details['purple_integral'] += $jl * 0.7; // 百分之70的紫积分
-                        $details['business_integral'] += $jl * 0.0006; // 百分之30的商家积分
-                        $v3++;
                     }
-                }else{
-                    $jl = 0;
-                }
-                if ($jl > 0){
-                    User::where('uid', $value)->inc('purple_integral', $jl * 0.7)->update();
-                    User::where('uid', $value)->inc('business_integral', $jl * 0.0006)->update();
-                    UserBill::income('团队奖励阳光积分', $details['uid'], 'purple_integral', 'td_purple_integral', $jl * 0.7, 0,$details['purple_integral'], '打怪胜利补贴'.$many['name'].'-第'.$order['stage'].'期团队v'.$details['level'].'奖励阳光积分');
-                    UserBill::income('团队奖励美好积分', $details['uid'], 'business_integral', 'td_business_integral', $jl * 0.0006, 0,$details['integral'], '打怪胜利补贴'.$many['name'].'-第'.$order['stage'].'期期团队v'.$details['level'].'奖励美好积分');
                 }
-                $jl = 0;
+
             }
+            Push::create(['add_time' => strtotime('today'), 'type' => 1]); //存入数据库信息
         }
+
     }
 
     /**
@@ -283,7 +299,7 @@ class ManyOrder extends BaseModel
      */
     public static function time()
     {
-        if (!Push::where('add_time', strtotime('today'))->find()) {
+        if (!Push::where('add_time', strtotime('today'))->where('type', 0)->find()) {
             Push::create(['add_time' => strtotime('today')]); //存入数据库信息
         }
     }

+ 67 - 48
app/models/store/StoreOrder.php

@@ -431,47 +431,64 @@ class StoreOrder extends BaseModel
                     'SurplusIntegral' => $SurplusIntegral,
                 ];
             }
-            $orderInfo = [
-                'uid' => $uid,
-                'order_id' => $test ? 0 : self::getNewOrderId(),
-                'real_name' => $addressInfo['real_name'],
-                'user_phone' => $addressInfo['phone'],
-                'user_address' => $addressInfo['province'] . ' ' . $addressInfo['city'] . ' ' . $addressInfo['district'] . ' ' . $addressInfo['detail'],
-                'cart_id' => $cartIds,
-                'total_num' => $totalNum,
-                'total_price' => $priceGroup['totalPrice'],
-                'total_postage' => $priceGroup['storePostage'],
-                'coupon_id' => $couponId,
-                'coupon_price' => $couponPrice,
-                'pay_price' => $payPrice,
-                'pay_postage' => $payPostage,
-                'deduction_price' => $deductionPrice,
-                'paid' => 0,
-                'pay_type' => $payType,
-                'use_integral' => $usedIntegral + $payIntegral,
-                'gain_integral' => $gainIntegral,
-                'white_integral' => $whiteIntegral,
-                'business_integral' => $businessIntegral,
-                'mark' => htmlspecialchars($mark),
-                'combination_id' => $combinationId,
-                'pink_id' => $pinkId,
-                'seckill_id' => $seckill_id,
-                'bargain_id' => $bargain_id,
-                'cost' => $priceGroup['costPrice'],
-                'is_channel' => $isChannel,
-                'add_time' => time(),
-                'unique' => $key,
-                'shipping_type' => $shipping_type,
-                'freight_price' => 0,
-                'refund_price' => 0
-            ];
-            if ($shipping_type === 2) {
-                $orderInfo['verify_code'] = self::getStoreCode();
-                $orderInfo['store_id'] = SystemStore::getStoreDispose($storeId, 'id');
-                if (!$orderInfo['store_id']) return self::setErrorInfo('暂无门店无法选择门店自提!', true);
+            $orderDate = StoreOrder::where('uid', $uid)->where('paid', 1)->where('pay_type', '<>', 'integral')->where('add_time', '>=', strtotime('2020-8-5'))->where('cumulative', '<', 2000)->find();
+            if ($payPrice < 2000 and $orderDate){
+                $orderDate['order_id'] = self::getNewOrderId();
+                $orderDate['pay_price'] = $payPrice;
+                $orderDate['gain_integral'] = $gainIntegral;
+                $orderDate['white_integral'] = $whiteIntegral;
+                $orderDate['business_integral'] = $businessIntegral;
+                $orderDate->save();
+                StoreOrderStatus::status($orderDate['id'], 'cache_key_create_order', '订单累计'.$payPrice);
+                $order = $orderDate;
+                $res4 = true;
+            }else{
+                $orderInfo = [
+                    'uid' => $uid,
+                    'order_id' => $test ? 0 : self::getNewOrderId(),
+                    'real_name' => $addressInfo['real_name'],
+                    'user_phone' => $addressInfo['phone'],
+                    'user_address' => $addressInfo['province'] . ' ' . $addressInfo['city'] . ' ' . $addressInfo['district'] . ' ' . $addressInfo['detail'],
+                    'cart_id' => $cartIds,
+                    'total_num' => $totalNum,
+                    'total_price' => $priceGroup['totalPrice'],
+                    'total_postage' => $priceGroup['storePostage'],
+                    'coupon_id' => $couponId,
+                    'coupon_price' => $couponPrice,
+                    'pay_price' => $payPrice,
+                    'pay_postage' => $payPostage,
+                    'deduction_price' => $deductionPrice,
+                    'paid' => 0,
+                    'pay_type' => $payType,
+                    'use_integral' => $usedIntegral + $payIntegral,
+                    'gain_integral' => $gainIntegral,
+                    'white_integral' => $whiteIntegral,
+                    'business_integral' => $businessIntegral,
+                    'mark' => htmlspecialchars($mark),
+                    'combination_id' => $combinationId,
+                    'pink_id' => $pinkId,
+                    'seckill_id' => $seckill_id,
+                    'bargain_id' => $bargain_id,
+                    'cost' => $priceGroup['costPrice'],
+                    'is_channel' => $isChannel,
+                    'add_time' => time(),
+                    'unique' => $key,
+                    'shipping_type' => $shipping_type,
+                    'freight_price' => 0,
+                    'refund_price' => 0,
+                    'cumulative' => 0
+                ];
+                if ($shipping_type === 2) {
+                    $orderInfo['verify_code'] = self::getStoreCode();
+                    $orderInfo['store_id'] = SystemStore::getStoreDispose($storeId, 'id');
+                    if (!$orderInfo['store_id']) return self::setErrorInfo('暂无门店无法选择门店自提!', true);
+                }
+                $order = self::create($orderInfo);
+                if (!$order) return self::setErrorInfo('订单生成失败!', true);
+                StoreOrderStatus::status($order['id'], 'cache_key_create_order', '订单生成');
+                //保存购物车商品信息
+                $res4 = false !== StoreOrderCartInfo::setCartInfo($order['id'], $cartInfo);
             }
-            $order = self::create($orderInfo);
-            if (!$order) return self::setErrorInfo('订单生成失败!', true);
             $res5 = true;
             foreach ($cartInfo as $cart) {
                 //减库存加销量
@@ -480,8 +497,6 @@ class StoreOrder extends BaseModel
                 else if ($bargain_id) $res5 = $res5 && StoreBargain::decBargainStock($cart['cart_num'], $bargain_id, isset($cart['productInfo']['attrInfo']) ? $cart['productInfo']['attrInfo']['unique'] : '');
                 else $res5 = $res5 && StoreProduct::decProductStock($cart['cart_num'], $cart['productInfo']['id'], isset($cart['productInfo']['attrInfo']) ? $cart['productInfo']['attrInfo']['unique'] : '');
             }
-            //保存购物车商品信息
-            $res4 = false !== StoreOrderCartInfo::setCartInfo($order['id'], $cartInfo);
             //购物车状态修改
             $res6 = false !== StoreCart::where('id', 'IN', $cartIds)->update(['is_pay' => 1]);
             if (!$res4 || !$res5 || !$res6) return self::setErrorInfo('订单生成失败!', true);
@@ -489,7 +504,6 @@ class StoreOrder extends BaseModel
             UserRepository::storeProductOrderCreateEbApi($order, compact('cartInfo', 'addressId'));
             self::clearCacheOrderInfo($uid, $key);
             self::commitTrans();
-            StoreOrderStatus::status($order['id'], 'cache_key_create_order', '订单生成');
             return $order;
         } catch (\PDOException $e) {
             self::rollbackTrans();
@@ -675,7 +689,7 @@ class StoreOrder extends BaseModel
     {
         $orderInfo = self::where('uid', $uid)->where('order_id', $order_id)->where('is_del', 0)->find();
         if (!$orderInfo) return self::setErrorInfo('订单不存在!');
-        if ($orderInfo['paid']) return self::setErrorInfo('该订单已支付!');
+//        if ($orderInfo['paid']) return self::setErrorInfo('该订单已支付!');
 //        if($orderInfo['pay_type'] != 'yue') return self::setErrorInfo('该订单不能使用余额支付!');
         $userInfo = User::getUserInfo($uid);
         if ($userInfo['now_money'] < $orderInfo['pay_price'])
@@ -842,10 +856,15 @@ class StoreOrder extends BaseModel
     {
         $order = self::where('order_id', $orderId)->find();
         $resPink = true;
-        $res1 = self::where('order_id', $orderId)->update(['paid' => 1, 'pay_type' => $paytype, 'pay_time' => time(), 'is_del' => 0, 'is_system_del' => 0, 'mark' => '']);//订单改为支付
+        $paid = $order['paid'];
+        $res1 = self::where('order_id', $orderId)->update(['paid' => 1, 'pay_type' => $paytype, 'pay_time' => time(), 'is_del' => 0, 'is_system_del' => 0, 'mark' => '', 'cumulative' => $order['pay_price']+$order['cumulative'], 're_order_id' => $orderId]);//订单改为支付
         if ($order->combination_id && $res1 && !$order->refund_status) $resPink = StorePink::createPink($order);//创建拼团
         $oid = self::where('order_id', $orderId)->value('id');
-        StoreOrderStatus::status($oid, 'pay_success', '用户付款成功');
+        if ($paid == 1){
+            StoreOrderStatus::status($oid, 'pay_success', '用户累计订单付款成功'.$order['pay_price']);
+        }else{
+            StoreOrderStatus::status($oid, 'pay_success', '用户付款成功');
+        }
         $now_money = User::where('uid', $order['uid'])->value('now_money');
         UserBill::expend('购买商品', $order['uid'], 'now_money', 'pay_money', $order['pay_price'], $order['id'], $now_money, '支付' . floatval($order['pay_price']) . '元购买商品');
         //支付成功后
@@ -1183,10 +1202,10 @@ class StoreOrder extends BaseModel
     public static function getUserOrderList($uid, $status = '', $page = 0, $limit = 8)
     {
         if ($page) $list = self::statusByWhere($status, $uid)->where('is_del', 0)->where('uid', $uid)
-            ->field('add_time,seckill_id,bargain_id,combination_id,id,order_id,pay_price,total_num,total_price,pay_postage,total_postage,paid,status,refund_status,pay_type,coupon_price,deduction_price,pink_id,delivery_type,is_del,shipping_type')
+            ->field('add_time,seckill_id,bargain_id,combination_id,id,order_id,pay_price,total_num,total_price,pay_postage,total_postage,paid,status,refund_status,pay_type,coupon_price,deduction_price,pink_id,delivery_type,is_del,shipping_type,cumulative')
             ->order('add_time DESC')->page((int)$page, (int)$limit)->select()->toArray();
         else  $list = self::statusByWhere($status, $uid)->where('is_del', 0)->where('uid', $uid)
-            ->field('add_time,seckill_id,bargain_id,combination_id,id,order_id,pay_price,total_num,total_price,pay_postage,total_postage,paid,status,refund_status,pay_type,coupon_price,deduction_price,pink_id,delivery_type,is_del,shipping_type')
+            ->field('add_time,seckill_id,bargain_id,combination_id,id,order_id,pay_price,total_num,total_price,pay_postage,total_postage,paid,status,refund_status,pay_type,coupon_price,deduction_price,pink_id,delivery_type,is_del,shipping_type,cumulative')
             ->order('add_time DESC')->page((int)$page, (int)$limit)->select()->toArray();
         foreach ($list as $k => $order) {
             $list[$k] = self::tidyOrder($order, true);

+ 6 - 0
app/models/user/UserBill.php

@@ -8,6 +8,7 @@
 
 namespace app\models\user;
 
+use app\models\many\ManyOrder;
 use app\models\store\StoreOrder;
 use think\facade\Cache;
 use crmeb\traits\ModelTrait;
@@ -82,6 +83,11 @@ class UserBill extends BaseModel
         $data['list'] = count($list) ? $list->toArray() : [];
         $data['zc'] = self::where('uid', $uid)->where('category', $category)->where('pm', 0)->sum('number');
         $data['sr'] = self::where('uid', $uid)->where('category', $category)->where('pm', 1)->sum('number');
+        if ($category == 'purple_integral') {
+            $data['cyz'] = ManyOrder::where('uid', $uid)->where('status', 0)->where('is_return', 0)->sum('price');
+            $data['dsf'] = ManyOrder::where('uid', $uid)->where('status', 0)->where('is_return', 1)->sum('price');
+            $data['yjs'] = ManyOrder::where('uid', $uid)->where('status', 1)->sum('price');
+        }
         foreach ($data['list'] as &$v) {
             $v['add_time'] = date('Y/m/d H:i', $v['add_time']);
             $v['number'] = floatval($v['number']);

+ 2 - 1
app/models/user/UserExtract.php

@@ -88,7 +88,8 @@ class UserExtract extends BaseModel
             'extract_price' => ($data['money']*0.98) - 2,
             'add_time' => time(),
             'balance' => $balance,
-            'status' => self::AUDIT_STATUS
+            'status' => self::AUDIT_STATUS,
+            'money' => $data['money']
         ];
         if(isset($data['name']) && strlen(trim($data['name']))) $insertData['real_name'] = $data['name'];
         else $insertData['real_name'] = $userInfo['nickname'];

+ 1 - 1
app/register/view/index/down.html

@@ -66,7 +66,7 @@
 <body>
 <div class="div">
     <img class="img" src="/static/img/down.jpg"/>
-    <a href="{$apk}" downLoad="xhg.apk">
+    <a href="{$apk}" downLoad="mhrs.apk">
         <div class="button">Android版本下载</div>
     </a>
 </div>

+ 3 - 3
app/register/view/index/index.html

@@ -11,7 +11,7 @@
 </head>
 <body>
 <div class="container">
-    <div class="loginTitle">欢迎注册喜嗨购</div>
+    <div class="loginTitle">欢迎注册美好人参</div>
     <div class="loginText">请认真填写个人信息</div>
     <div class="login-box">
         <div class="username">账号</div>
@@ -70,7 +70,7 @@
         }
         $.ajax({
             type: "post",
-            url: "http://xhg.duolio.cn/api/register",
+            url: "http://xhg.zhejiangtaizhou.cn/api/register",
             data: {account: phone, captcha: code, password: loginPass, spread: invitation},
             dataType: "json",
             success: function (data) {
@@ -111,7 +111,7 @@
         }
         $.ajax({
             type: "post",
-            url: "http://xhg.duolio.cn/api/register/verify",
+            url: "http://xhg.zhejiangtaizhou.cn/api/register/verify",
             data: {phone: phone, type: 'register'},
             dataType: "json",
             success: function (data) {

+ 1 - 1
config/app.php

@@ -33,7 +33,7 @@ return [
     // 禁止URL访问的应用列表(自动多应用模式有效)
     'deny_app_list'    => [],
     // 默认应用
-    'default_app'      => 'wap',
+    'default_app'      => 'admin',
     // 默认时区
     'default_timezone' => 'Asia/Shanghai',
     // 异常页面的模板文件

+ 4 - 4
crmeb/repositories/OrderRepository.php

@@ -35,7 +35,7 @@ class OrderRepository
         else
             $orderInfo = $orderId;
         if (!$orderInfo || !isset($orderInfo['paid'])) exception('支付订单不存在!');
-        if ($orderInfo['paid']) exception('支付已支付!');
+//        if ($orderInfo['paid']) exception('支付已支付!');
         if ($orderInfo['pay_price'] <= 0) exception('该支付无需支付!');
         $openid = WechatUser::getOpenId($orderInfo['uid']);
         $bodyContent = StoreOrder::getProductTitle($orderInfo['cart_id']);
@@ -60,7 +60,7 @@ class OrderRepository
         else
             $orderInfo = $orderId;
         if (!$orderInfo || !isset($orderInfo['paid'])) exception('支付订单不存在!');
-        if ($orderInfo['paid']) exception('支付已支付!');
+//        if ($orderInfo['paid']) exception('支付已支付!');
         if ($orderInfo['pay_price'] <= 0) exception('该支付无需支付!');
         $openid = WechatUser::uidToOpenid($orderInfo['uid'], 'openid');
         $bodyContent = StoreOrder::getProductTitle($orderInfo['cart_id']);
@@ -85,7 +85,7 @@ class OrderRepository
         else
             $orderInfo = $orderId;
         if (!$orderInfo || !isset($orderInfo['paid'])) exception('支付订单不存在!');
-        if ($orderInfo['paid']) exception('支付已支付!');
+//        if ($orderInfo['paid']) exception('支付已支付!');
         if ($orderInfo['pay_price'] <= 0) exception('该支付无需支付!');
         $bodyContent = StoreOrder::getProductTitle($orderInfo['cart_id']);
         $site_name = sys_config('site_name');
@@ -229,7 +229,7 @@ class OrderRepository
         else
             $orderInfo = $order;
         if (!$orderInfo || !isset($orderInfo['paid'])) exception('支付订单不存在!');
-        if ($orderInfo['paid']) exception('支付已支付!');
+//        if ($orderInfo['paid']) exception('支付已支付!');
         if ($orderInfo['pay_price'] <= 0) exception('该支付无需支付!');
         $bodyContent = StoreOrder::getProductTitle($orderInfo['cart_id']);
         $site_name = sys_config('site_name');

+ 1 - 1
crmeb/repositories/PaymentRepositories.php

@@ -51,7 +51,7 @@ class PaymentRepositories
     public static function wechatProduct(string $order_id = null)
     {
         try {
-            if (StoreOrder::be(['order_id' => $order_id, 'paid' => 1])) return true;
+            if (StoreOrder::be(['re_order_id' => $order_id])) return true;
             return StoreOrder::paySuccess($order_id);
         } catch (\Exception $e) {
             return false;

+ 8 - 0
crmeb/subscribes/TaskSubscribe.php

@@ -120,6 +120,14 @@ class TaskSubscribe
         } catch (\Exception $e) {
             Db::rollback();
         }
+        try {
+            Db::startTrans();
+            ManyOrder::push(); // 团队奖励
+            Db::commit();
+        } catch (\Exception $e) {
+            Db::rollback();
+        }
+
         ManyOrder::time(); //流水分红
     }
 

+ 2 - 0
public/index/index.html

@@ -0,0 +1,2 @@
+<!DOCTYPE html><html lang=zh-CN><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><title>美好人参</title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
+            document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=/index/static/index.2772579d.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/index/static/js/chunk-vendors.fa744ab3.js></script><script src=/index/static/js/index.ebd2dd3d.js></script></body></html>

+ 556 - 0
public/index/static/css/cmy.css

@@ -0,0 +1,556 @@
+/*初始化类*/
+@font-face {
+	font-family: 'iconfont';
+	/* project id 1482221 */
+	src: url('https://at.alicdn.com/t/font_1482221_x9emymthrxs.eot');
+	src: url('https://at.alicdn.com/t/font_1482221_x9emymthrxs.eot?#iefix') format('embedded-opentype'),
+		url('https://at.alicdn.com/t/font_1482221_x9emymthrxs.woff2') format('woff2'),
+		url('https://at.alicdn.com/t/font_1482221_x9emymthrxs.woff') format('woff'),
+		url('https://at.alicdn.com/t/font_1482221_x9emymthrxs.ttf') format('truetype'),
+		url('https://at.alicdn.com/t/font_1482221_x9emymthrxs.svg#iconfont') format('svg');
+}
+
+.acea-row {
+	display: -webkit-box;
+	display: -moz-box;
+	display: -webkit-flex;
+	display: -ms-flexbox;
+	display: flex;
+	-webkit-box-lines: multiple;
+	-moz-box-lines: multiple;
+	-o-box-lines: multiple;
+	-webkit-flex-wrap: wrap;
+	-ms-flex-wrap: wrap;
+	flex-wrap: wrap
+}
+
+.acea-row.row-middle {
+	-webkit-box-align: center;
+	-moz-box-align: center;
+	-o-box-align: center;
+	-ms-flex-align: center;
+	-webkit-align-items: center;
+	align-items: center
+}
+
+.bg-color-red {
+	background-color: #e93323 !important;
+}
+
+.acea-row.row-right {
+	-webkit-box-pack: end;
+	-moz-box-pack: end;
+	-o-box-pack: end;
+	-ms-flex-pack: end;
+	-webkit-justify-content: flex-end;
+	justify-content: flex-end
+}
+
+.acea-row.row-between-wrapper {
+	-webkit-box-align: center;
+	-moz-box-align: center;
+	-o-box-align: center;
+	-ms-flex-align: center;
+	-webkit-align-items: center;
+	align-items: center;
+	-webkit-box-pack: justify;
+	-moz-box-pack: justify;
+	-o-box-pack: justify;
+	-ms-flex-pack: justify;
+	-webkit-justify-content: space-between;
+	justify-content: space-between
+}
+
+.acea-row.row-column-around {
+	-webkit-flex-direction: column;
+	-ms-flex-direction: column;
+	flex-direction: column;
+	justify-content: space-around;
+	-webkit-justify-content: space-around
+}
+
+.acea-row.row-center-wrapper {
+	-webkit-box-align: center;
+	-moz-box-align: center;
+	-o-box-align: center;
+	-ms-flex-align: center;
+	-webkit-align-items: center;
+	align-items: center;
+	-webkit-box-pack: center;
+	-moz-box-pack: center;
+	-o-box-pack: center;
+	-ms-flex-pack: center;
+	-webkit-justify-content: center;
+	justify-content: center
+}
+
+.iconfont {
+	font-family: "iconfont" !important;
+	font-size: 34rpx;
+	font-style: normal;
+	-webkit-font-smoothing: antialiased;
+	-webkit-text-stroke-width: 0rpx;
+	-moz-osx-font-smoothing: grayscale;
+}
+
+.iconedit:before {
+	content: "\e649";
+}
+
+.iconfavorfill:before {
+	content: "\e64b";
+}
+
+.iconfavor:before {
+	content: "\e64c";
+}
+
+.iconlocation:before {
+	content: "\e651";
+}
+
+.iconroundcheckfill:before {
+	content: "\e656";
+}
+
+.iconroundcheck:before {
+	content: "\e657";
+}
+
+.iconunfold:before {
+	content: "\e661";
+}
+
+.iconlikefill:before {
+	content: "\e668";
+}
+
+.iconlike:before {
+	content: "\e669";
+}
+
+.iconshop:before {
+	content: "\e676";
+}
+
+.iconcart:before {
+	content: "\e6af";
+}
+
+.icondelete:before {
+	content: "\e6b4";
+}
+
+.iconhome:before {
+	content: "\e6b8";
+}
+
+.iconcartfill:before {
+	content: "\e6b9";
+}
+
+.iconhomefill:before {
+	content: "\e6bb";
+}
+
+.iconlock:before {
+	content: "\e6c0";
+}
+
+.iconfriendadd:before {
+	content: "\e6ca";
+}
+
+.iconfold:before {
+	content: "\e6de";
+}
+
+.iconapps:before {
+	content: "\e729";
+}
+
+.iconadd:before {
+	content: "\e767";
+}
+
+.iconaddred:before {
+	content: "\e767";
+	color: #F35B64;
+}
+
+.iconmove:before {
+	content: "\e768";
+}
+
+.icontriangledownfill:before {
+	content: "\e79b";
+}
+
+.icontriangleupfill:before {
+	content: "\e79c";
+}
+
+.iconshaixuan:before {
+	content: "\e74a";
+}
+
+.iconyanzhengma:before {
+	content: "\e684";
+}
+
+.iconjifen:before {
+	content: "\e60f";
+}
+
+.iconwuliuxinxi:before {
+	content: "\e62b";
+}
+
+.iconmessage:before {
+	content: "\e78a";
+}
+
+.iconsetting:before {
+	content: "\e78e";
+}
+
+.iconaddition:before {
+	content: "\e6e0";
+}
+
+.iconclose:before {
+	content: "\e6e9";
+}
+
+.iconenter:after {
+	content: "\e6f8";
+}
+
+.iconprompt:before {
+	content: "\e71b";
+}
+
+.iconreturn:before {
+	content: "\e720";
+}
+
+.iconsearch:before {
+	content: "\e741";
+}
+
+.iconpengyouquan:before {
+	content: "\e62c";
+}
+
+.iconweixin:before {
+	content: "\e60e";
+}
+
+.iconzhifubao:before {
+	content: "\e673";
+}
+
+.iconyue:before {
+	content: "\e618";
+}
+
+.iconweixin1:before {
+	content: "\e622";
+}
+
+.iconlock1:before {
+	content: "\e64d";
+}
+
+.iconuser:before {
+	content: "\e64e";
+}
+
+.iconchenggongtixianshouyi:before {
+	content: "\e64f";
+}
+
+.iconviptuiguangdingdan:before {
+	content: "\e650";
+}
+
+.icondaifukuan:before {
+	content: "\e652";
+}
+
+.icondaijiesuanshouyi:before {
+	content: "\e653";
+}
+
+.icondaidakuanshouyi:before {
+	content: "\e654";
+}
+
+.icondaifahuo:before {
+	content: "\e655";
+}
+
+.icondaishouhuoshouyi:before {
+	content: "\e658";
+}
+
+.icondaishouhuo:before {
+	content: "\e659";
+}
+
+.iconwuxiaoshouyi:before {
+	content: "\e65a";
+}
+
+.icontixianmingxi:before {
+	content: "\e65b";
+}
+
+.iconshouyi:before {
+	content: "\e65c";
+}
+
+.iconkouchutixianshouxufei:before {
+	content: "\e65d";
+}
+
+.iconyishenqingshouyi:before {
+	content: "\e65e";
+}
+
+.icontuihuanhuo:before {
+	content: "\e65f";
+}
+
+
+/*水平线*/
+.hr {
+	width: 100%;
+	position: relative;
+	border-bottom: 1px solid #dddddd;
+	/* height: 0.5rpx; */
+}
+
+/* 一行显示 */
+.clamp {
+	overflow: hidden;
+	text-overflow: ellipsis;
+	white-space: nowrap;
+	display: block;
+}
+
+/* 二行显示 */
+.clamp2 {
+	overflow: hidden;
+	text-overflow: ellipsis;
+	display: -webkit-box;
+	-webkit-line-clamp: 2;
+	-webkit-box-orient: vertical;
+}
+
+/* 二行显示 */
+.ellipsis {
+	overflow: hidden;
+	text-overflow: ellipsis;
+	display: -webkit-box;
+	-webkit-box-orient: vertical;
+	-webkit-line-clamp: 2;
+}
+
+.common-hover {
+	background: #f5f5f5;
+}
+
+/* 角标 */
+.corner {
+	background-color: #e51c23;
+	position: absolute;
+	right: -18rpx;
+	top: -18rpx;
+	color: #FFFFFF;
+	text-align: center;
+	border-radius: 999px;
+	font-size: 24rpx !important;
+	min-width: 35rpx;
+	min-height: 35rpx;
+	display: flex;
+	align-items: center;
+	justify-content: center;
+	line-height: 1;
+}
+
+.flex_item {
+	display: flex;
+	align-items: center;
+	/* justify-content: space-between; */
+}
+
+/* 左右顶格加上下居中 */
+.flex-between-center {
+	display: flex;
+	justify-content: space-between;
+	align-items: center;
+}
+
+/* flex布局-整体居中 */
+.flex-center {
+	display: flex;
+	align-items: center;
+	justify-content: center;
+}
+
+.flex-start {
+	display: flex;
+	align-items: center;
+	justify-content: flex-start;
+}
+
+/*文字对齐*/
+.text-left {
+	text-align: left !important;
+}
+
+.text-center {
+	text-align: center !important;
+}
+
+.text-justify {
+	text-align: justify !important;
+}
+
+.text-right {
+	text-align: right !important;
+}
+
+.text-default {
+	color: #212121 !important;
+}
+
+.text-white {
+	color: #ffffff !important;
+}
+
+.text-primary {
+	color: #00bcd4 !important;
+}
+
+.text-success {
+	color: #009688 !important;
+}
+
+.text-info {
+	color: #03a9f4 !important;
+}
+
+.text-warning {
+	color: #ffc107 !important;
+}
+
+.text-danger {
+	color: #e51c23 !important;
+}
+
+.text-pink {
+	color: #e91e63 !important;
+}
+
+.text-purple {
+	color: #673ab7 !important;
+}
+
+.text-indigo {
+	color: #3f51b5 !important;
+}
+
+.text-gray {
+	color: #999999 !important;
+}
+
+.bg-default {
+	background-color: #f5f5f5 !important;
+}
+
+.bg-primary {
+	background-color: #00bcd4 !important;
+}
+
+.bg-success {
+	background-color: #009688 !important;
+}
+
+.bg-info {
+	background-color: #03a9f4 !important;
+}
+
+.bg-warning {
+	background-color: #FFB238 !important;
+}
+
+.bg-danger {
+	background-color: #DC4D46 !important;
+}
+
+.bg-pink {
+	background-color: #e91e63 !important;
+}
+
+.bg-purple {
+	background-color: #673ab7 !important;
+}
+
+.bg-indigo {
+	background-color: #3f51b5 !important;
+}
+
+.bg-white {
+	background-color: white !important;
+}
+
+.bg-gray {
+	background-color: #e3e3e3 !important;
+}
+
+/* 边框 */
+.border-radius-15 {
+	border-radius: 15rpx;
+}
+
+.border-radius-10 {
+	border-radius: 10rpx;
+}
+
+.border-radius-all {
+	border-radius: 1000rpx;
+}
+
+/* 底部边线 */
+.borde-b {
+	border-bottom: 1px solid #dddddd;
+}
+
+/* 弹性盒子 */
+.flex {
+	display: flex;
+	align-items: center;
+	justify-content: space-between;
+}
+
+.items-left {
+	justify-content: flex-start;
+}
+
+.items-right {
+	justify-content: flex-end;
+}
+
+.flex-shrink-false {
+	flex-shrink: 0;
+}
+
+.flex-grow-true {
+	flex-grow: 1;
+}
+
+.position-relative {
+	position: relative;
+}

+ 53 - 0
public/index/static/css/flex.css

@@ -0,0 +1,53 @@
+/* flex 布局 */
+.f-d-c {
+	flex-direction: column;
+}
+
+.f-j-c {
+	justify-content: center;
+}
+
+.f-j-s {
+	justify-content: flex-start;
+}
+
+.f-j-e {
+	justify-content: flex-end;
+}
+
+.f-j-sa {
+	justify-content: space-around;
+}
+
+.f-j-sb {
+	justify-content: space-between;
+}
+
+.f-ai-c {
+	align-items: center;
+}
+
+.f-ai-s {
+	align-items: flex-start;
+}
+
+.f-ai-e {
+	align-items: flex-end;
+}
+
+.fg1 {
+	flex-grow: 1;
+}
+
+.fs0 {
+	flex-shrink: 0;
+}
+
+/* 相对定位&绝对定位 */
+.p-r {
+	position: relative;
+}
+
+.p-a {
+	position: absolute;
+}

+ 36 - 0
public/index/static/css/padding.css

@@ -0,0 +1,36 @@
+/* padding */
+.pl10 {
+	padding-left: 10rpx;
+}
+
+.pt10 {
+	padding-top: 10rpx;
+}
+
+.pt15 {
+	padding-top: 15rpx;
+}
+
+.pl15 {
+	padding-left: 15rpx;
+}
+
+.pt20 {
+	padding-top: 20rpx;
+}
+
+.pl20 {
+	padding-left: 20rpx;
+}
+
+.pr10 {
+	padding-right: 10rpx;
+}
+
+.pr15 {
+	padding-right: 15rpx;
+}
+
+.pr20 {
+	padding-right: 20rpx;
+}

BIN
public/index/static/error/emptyCart.png


BIN
public/index/static/error/errorImage.jpg


BIN
public/index/static/error/missing-face.png


BIN
public/index/static/game/game1.png


BIN
public/index/static/game/game10.png


BIN
public/index/static/game/game11.png


BIN
public/index/static/game/game2.png


BIN
public/index/static/game/game21.png


BIN
public/index/static/game/game22.png


BIN
public/index/static/game/game23.png


BIN
public/index/static/game/game24.png


BIN
public/index/static/game/game3.png


BIN
public/index/static/game/game4.png


BIN
public/index/static/game/game6.png


BIN
public/index/static/game/game7.png


BIN
public/index/static/game/game8.png


BIN
public/index/static/icon/add.png


BIN
public/index/static/icon/call.png


BIN
public/index/static/icon/dh.png


BIN
public/index/static/icon/dsjh.png


BIN
public/index/static/icon/fanhui.png


BIN
public/index/static/icon/i1.png


BIN
public/index/static/icon/i2.png


BIN
public/index/static/icon/i3.png


BIN
public/index/static/icon/i4.png


BIN
public/index/static/icon/img01.png


BIN
public/index/static/icon/img03.png


BIN
public/index/static/icon/img04.png


BIN
public/index/static/icon/img05.png


BIN
public/index/static/icon/reduce.png


BIN
public/index/static/img/add.png


BIN
public/index/static/img/bottom.png


BIN
public/index/static/img/call.94b30316.png


BIN
public/index/static/img/cash-bg.8993f7b8.png


BIN
public/index/static/img/cash-bg.png


BIN
public/index/static/img/delete.png


BIN
public/index/static/img/deletes.png


BIN
public/index/static/img/detailImg.2548823d.jpg


BIN
public/index/static/img/detailImg.jpg


BIN
public/index/static/img/dh.35663c8e.png


BIN
public/index/static/img/game1.7ca1e6cf.png


BIN
public/index/static/img/game10.1ba44d51.png


BIN
public/index/static/img/game11.4e9d7a5b.png


BIN
public/index/static/img/game2.beba2f35.png


BIN
public/index/static/img/game3.bad6d0b3.png


BIN
public/index/static/img/game4.542414b4.png


BIN
public/index/static/img/game6.aba1cb44.png


BIN
public/index/static/img/game8.4dd27a77.png


BIN
public/index/static/img/img009.609fc055.png


BIN
public/index/static/img/img009.png


BIN
public/index/static/img/img01.png


BIN
public/index/static/img/img010.becc4342.png


BIN
public/index/static/img/img010.png


BIN
public/index/static/img/img03.png


BIN
public/index/static/img/img04.png


BIN
public/index/static/img/img05.png


BIN
public/index/static/img/index01.png


BIN
public/index/static/img/index02.cc385428.png


BIN
public/index/static/img/index02.png


BIN
public/index/static/img/index03.223e9175.png


Some files were not shown because too many files changed in this diff