hrjy 2 years ago
parent
commit
b75be262a9

+ 266 - 0
app/admin/controller/many/Many.php

@@ -0,0 +1,266 @@
+<?php
+/**
+ *
+ * @author: xaboy<365615158@qq.com>
+ * @day: 2017/11/11
+ */
+
+namespace app\admin\controller\many;
+
+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 Many 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\many\Many::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('number', '数量');
+        $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',
+            'number',
+            'add_time',
+            'end_time',
+            'sort',
+        ]);
+        $validate = Validate::rule('name', 'require')->rule([
+            'name' => 'require',
+            'image' => 'require',
+            'money' => 'require',
+            'number' => 'require',
+            'add_time' => 'require',
+            'end_time' => 'require',
+        ]);
+        $validate->message([
+            'name.require' => '名称不能为空',
+            'image.require' => '图片不能为空',
+            'money.require' => '额度不能为空',
+            'number.require' => '数量不能为空',
+            'add_time.require' => '请选择进场时间',
+            'end_time.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\many\Many::find($id);
+        $f = [];
+        $f[] = Form::input('name', '名称',$data->getData('name'))->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('money', '额度', $data->getData('money'));
+        $f[] = Form::input('number', '数量',$data->getData('number'));
+        $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'));
+        $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\many\Many();
+        $data = Util::postMore([
+            'id',
+            'name',
+            'image',
+            'money',
+            'number',
+            'add_time',
+            'end_time',
+            'sort',
+        ]);
+        $validate = Validate::rule('name', 'require')->rule([
+            'name' => 'require',
+            'image' => 'require',
+            'money' => 'require',
+            'number' => 'require',
+            'add_time' => 'require',
+            'end_time' => 'require',
+        ]);
+        $validate->message([
+            'name.require' => '名称不能为空',
+            'image.require' => '图片不能为空',
+            'money.require' => '额度不能为空',
+            'number.require' => '数量不能为空',
+            'add_time.require' => '请选择进场时间',
+            'end_time.require' => '请选择结束时间',
+        ]);
+        if (!$validate->check($data)) {
+            return Json::fail($validate->getError());
+        }
+        $details = $model->find($data['id']);
+        $details['name'] = $data['name'];
+        $details['image'] = $data['image'];
+        $details['money'] = $data['money'];
+        $details['number'] = $data['number'];
+        $details['add_time'] = strtotime($data['add_time']);
+        $details['end_time'] = strtotime($data['end_time']);
+        $details['sort'] = $data['sort'];
+        $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['end_time'] > time() or $details['status'] == 1) return Json::fail('未结束不能进行下一场');
+        if ($details['suc'] == 2) return Json::fail('已众筹失败无法就行下一场');
+
+        $details['stage'] += 1;
+        $details['status'] = 1;
+        $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 = $model->where('id', $id)->delete();
+        if ($res){
+            return Json::success('删除成功!');
+        }else{
+            return Json::fail($model->getErrorInfo());
+        }
+
+    }
+
+}

+ 89 - 0
app/admin/controller/many/ManyDiscipline.php

@@ -0,0 +1,89 @@
+<?php
+/**
+ *
+ * @author: xaboy<365615158@qq.com>
+ * @day: 2017/11/11
+ */
+
+namespace app\admin\controller\many;
+
+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 ManyDiscipline extends AuthController
+{
+    /**
+     * @return mixed
+     */
+    public function index()
+    {
+        $list = \app\admin\model\many\Many::select();
+
+        $this->assign([
+            'year' => get_month(),
+            'auction'=> $list,
+
+        ]);
+
+        return $this->fetch();
+    }
+
+
+    public function list()
+    {
+        $where = Util::getMore([
+            ['status', ''],
+            ['page', 1],
+            ['limit', 20],
+            ['stage', ''],
+            ['order_id', ''],
+            ['excel', 0],
+            ['data', ''],
+            ['many_id',''],
+            ['name', '']
+        ]);
+
+        return Json::successlayui(\app\admin\model\many\ManyDiscipline::list($where));
+    }
+
+    /**
+     * 删除
+     * @param $id
+     * @return void
+     * @throws \Exception
+     */
+    public function delete($id)
+    {
+        if (!$id) Json::fail('删除失败');
+        $model = new \app\admin\model\many\Many();
+
+        $res = $model->where('id', $id)->delete();
+        if ($res){
+            return Json::success('删除成功!');
+        }else{
+            return Json::fail($model->getErrorInfo());
+        }
+
+    }
+
+}

+ 89 - 0
app/admin/controller/many/ManyOrder.php

@@ -0,0 +1,89 @@
+<?php
+/**
+ *
+ * @author: xaboy<365615158@qq.com>
+ * @day: 2017/11/11
+ */
+
+namespace app\admin\controller\many;
+
+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 ManyOrder extends AuthController
+{
+    /**
+     * @return mixed
+     */
+    public function index()
+    {
+        $list = \app\admin\model\many\Many::select();
+
+        $this->assign([
+            'year' => get_month(),
+            'auction'=> $list,
+
+        ]);
+
+        return $this->fetch();
+    }
+
+
+    public function list()
+    {
+        $where = Util::getMore([
+            ['status', ''],
+            ['page', 1],
+            ['limit', 20],
+            ['stage', ''],
+            ['order_id', ''],
+            ['excel', 0],
+            ['data', ''],
+            ['many_id',''],
+            ['name', '']
+        ]);
+
+        return Json::successlayui(\app\admin\model\many\ManyOrder::list($where));
+    }
+
+    /**
+     * 删除
+     * @param $id
+     * @return void
+     * @throws \Exception
+     */
+    public function delete($id)
+    {
+        if (!$id) Json::fail('删除失败');
+        $model = new \app\admin\model\many\Many();
+
+        $res = $model->where('id', $id)->delete();
+        if ($res){
+            return Json::success('删除成功!');
+        }else{
+            return Json::fail($model->getErrorInfo());
+        }
+
+    }
+
+}

+ 5 - 1
app/admin/controller/store/StoreProduct.php

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

+ 59 - 0
app/admin/model/many/Many.php

@@ -0,0 +1,59 @@
+<?php
+/**
+ * @author: xaboy<365615158@qq.com>
+ * @day: 2017/11/11
+ */
+
+namespace app\admin\model\many;
+
+use crmeb\traits\ModelTrait;
+use crmeb\basic\BaseModel;
+
+/**
+ * Class StoreCategory
+ * @package app\admin\model\store
+ */
+class Many extends BaseModel
+{
+
+    /**
+     * 数据表主键
+     * @var string
+     */
+    protected $pk = 'id';
+
+    /**
+     * 模型名称
+     * @var string
+     */
+    protected $name = 'many';
+
+    use ModelTrait;
+    protected $autoWriteTimestamp = true;
+
+
+
+    public static function list($where)
+    {
+        $model = self::field('*');
+
+        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();
+        foreach ($list as &$item){
+            $item['add_time'] = date('Y-m-d H:i:s',$item['add_time']);
+            $item['end_time'] = date('Y-m-d H:i:s',$item['end_time']);
+        }
+        $data['data'] = $list;
+        return $data;
+
+    }
+
+
+}

+ 98 - 0
app/admin/model/many/ManyDiscipline.php

@@ -0,0 +1,98 @@
+<?php
+/**
+ * @author: xaboy<365615158@qq.com>
+ * @day: 2017/11/11
+ */
+
+namespace app\admin\model\many;
+
+use crmeb\services\PHPExcelService;
+use crmeb\traits\ModelTrait;
+use crmeb\basic\BaseModel;
+
+/**
+ * Class StoreCategory
+ * @package app\admin\model\store
+ */
+class ManyDiscipline extends BaseModel
+{
+
+    /**
+     * 数据表主键
+     * @var string
+     */
+    protected $pk = 'id';
+
+    /**
+     * 模型名称
+     * @var string
+     */
+    protected $name = 'many_discipline';
+
+    use ModelTrait;
+    protected $autoWriteTimestamp = true;
+
+
+
+    public static function list($where)
+    {
+        $model = self::alias('a')
+        ->field('a.*,b.name')
+        ->leftJoin('many b', 'b.id = a.many_id');
+
+        if ($where['stage'])$model->where('a.stage' , '=', $where['stage']);
+        if (trim($where['many_id']) != '')$model->where('b.id' , '=', $where['many_id']);
+        if (trim($where['data']) != '') $model = self::getModelTime($where, $model,  'a.create_time');
+        $data['count'] = $model->count();
+
+        if (isset($where['excel']) && $where['excel'] == 1) {
+            $list = ($list = $model->select()) && count($list) ? $list->toArray() : [];
+        } else {
+            $list = ($list = $model->page((int)$where['page'], (int)$where['limit'])->select()) && count($list) ? $list->toArray() : [];
+        }
+        if (isset($where['excel']) && $where['excel'] == 1) {
+            self::SaveExcel($list);
+        }
+
+        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;
+
+    }
+
+    /*
+    * 保存并下载excel
+    * $list array
+    * return
+    */
+    public static function SaveExcel($list)
+    {
+        $export = [];
+        foreach ($list as $index => $item) {
+            $status = $item['status']== 0 ? '正常' :  $item['status']== 1 ? '成功返还':$item['status']== 2 ? '失败返还': '未知';
+            $export[] = [
+                $item['order_id'],
+                $item['nickname'],
+                $item['name'],
+                $item['stage'],
+                $item['price'],
+                $status,
+                $item['create_time'],
+            ];
+        }
+        PHPExcelService::setExcelHeader(['订单号', '用户', '众筹名称', '期数', '金额', '状态',
+            '订单时间'])
+            ->setExcelTile('订单导出' . date('YmdHis', time()), '订单信息' . time(), ' 生成时间:' . date('Y-m-d H:i:s', time()))
+            ->setExcelContent($export)
+            ->ExcelSave();
+    }
+
+
+
+
+}

+ 102 - 0
app/admin/model/many/ManyOrder.php

@@ -0,0 +1,102 @@
+<?php
+/**
+ * @author: xaboy<365615158@qq.com>
+ * @day: 2017/11/11
+ */
+
+namespace app\admin\model\many;
+
+use crmeb\services\PHPExcelService;
+use crmeb\traits\ModelTrait;
+use crmeb\basic\BaseModel;
+
+/**
+ * Class StoreCategory
+ * @package app\admin\model\store
+ */
+class ManyOrder extends BaseModel
+{
+
+    /**
+     * 数据表主键
+     * @var string
+     */
+    protected $pk = 'id';
+
+    /**
+     * 模型名称
+     * @var string
+     */
+    protected $name = 'many_order';
+
+    use ModelTrait;
+    protected $autoWriteTimestamp = true;
+
+
+
+    public static function list($where)
+    {
+        $model = self::alias('a')
+        ->field('a.*,b.name,u.nickname')
+        ->leftJoin('many b', 'b.id = a.many_id')
+        ->leftJoin('user u', 'u.uid = a.uid');
+
+        if ($where['order_id'])$model->where('a.order_id' , '=', $where['order_id']);
+        if ($where['status'])$model->where('a.status' , '=', $where['status']);
+        if ($where['stage'])$model->where('a.stage' , '=', $where['stage']);
+        if (trim($where['many_id']) != '')$model->where('b.id' , '=', $where['many_id']);
+        if (trim($where['name']) != '')$model->where('u.uid|u.account|u.nickname' , 'like', '%'.$where['name'].'%');
+        if (trim($where['data']) != '') $model = self::getModelTime($where, $model,  'a.create_time');
+        $data['count'] = $model->count();
+
+        if (isset($where['excel']) && $where['excel'] == 1) {
+            $list = ($list = $model->select()) && count($list) ? $list->toArray() : [];
+        } else {
+            $list = ($list = $model->page((int)$where['page'], (int)$where['limit'])->select()) && count($list) ? $list->toArray() : [];
+        }
+        if (isset($where['excel']) && $where['excel'] == 1) {
+            self::SaveExcel($list);
+        }
+
+        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;
+
+    }
+
+    /*
+    * 保存并下载excel
+    * $list array
+    * return
+    */
+    public static function SaveExcel($list)
+    {
+        $export = [];
+        foreach ($list as $index => $item) {
+            $status = $item['status']== 0 ? '正常' :  $item['status']== 1 ? '成功返还':$item['status']== 2 ? '失败返还': '未知';
+            $export[] = [
+                $item['order_id'],
+                $item['nickname'],
+                $item['name'],
+                $item['stage'],
+                $item['price'],
+                $status,
+                $item['create_time'],
+            ];
+        }
+        PHPExcelService::setExcelHeader(['订单号', '用户', '众筹名称', '期数', '金额', '状态',
+            '订单时间'])
+            ->setExcelTile('订单导出' . date('YmdHis', time()), '订单信息' . time(), ' 生成时间:' . date('Y-m-d H:i:s', time()))
+            ->setExcelContent($export)
+            ->ExcelSave();
+    }
+
+
+
+
+}

+ 11 - 35
app/admin/model/system/SystemUserTask.php

@@ -42,51 +42,27 @@ class SystemUserTask extends BaseModel
      */
     protected static $TaskType = [
         [
-            'type' => 'SatisfactionIntegral',
-            'name' => '满足积分{$num}',
-            'real_name' => '积分数',
+            'type' => 'DirectPush',
+            'name' => '直推下级有效账户{$num}',
+            'real_name' => '有效账户',
             'max_number' => 0,
             'min_number' => 0,
-            'unit' => ''
+            'unit' => ''
         ],
         [
-            'type' => 'ConsumptionAmount',
-            'name' => '消费满{$num}',
-            'real_name' => '消费金额',
+            'type' => 'UnderTheUmbrella',
+            'name' => '伞下有效账户{$num}',
+            'real_name' => '有效账户',
             'max_number' => 0,
             'min_number' => 0,
-            'unit' => ''
+            'unit' => ''
         ],
         [
-            'type' => 'ConsumptionFrequency',
-            'name' => '消费{$num}',
-            'real_name' => '消费次数',
+            'type' => 'SubordinateTwo',
+            'name' => '直推下级有{$num}账户下级有5个v2',
+            'real_name' => '有效账户',
             'max_number' => 0,
             'min_number' => 0,
-            'unit' => '次'
-        ],
-        [
-            'type' => 'CumulativeAttendance',
-            'name' => '累计签到{$num}',
-            'real_name' => '累计签到',
-            'max_number' => 365,
-            'min_number' => 1,
-            'unit' => '天'
-        ],
-        [
-            'type' => 'InviteGoodFriends',
-            'name' => '邀请好友{$num}成为下线',
-            'real_name' => '邀请好友成为下线',
-            'max_number' => 1000,
-            'min_number' => 1,
-            'unit' => '人'
-        ],
-        [
-            'type' => 'InviteGoodFriendsLevel',
-            'name' => '邀请好友{$num}成为会员',
-            'real_name' => '邀请好友成为会员',
-            'max_number' => 1000,
-            'min_number' => 1,
             'unit' => '人'
         ],
     ];

+ 197 - 0
app/admin/view/many/many/index.php

@@ -0,0 +1,197 @@
+{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: 'name', title: '名称', templet: '#name',  align: 'center'},
+            {field: 'image', title: '封面', templet: '#image', align: 'center', width: '5%'},
+            {field: 'money', title: '额度', align: 'center'},
+            {field: 'number', title: '数量', align: 'center'},
+            {field: 'stage', title: '期数', align: 'center'},
+            {field: 'suc', title: '众筹状态',  templet: '#suc',align: 'center'},
+            {field: 'status', title: '开启状态', templet: '#status', align: 'center'},
+            {field: 'sort', title: '排序', align: 'center'},
+            {field: 'add_time', title: '开始时间', align: 'center',width: '8%'},
+            {field: 'end_time', title: '结束时间', align: 'center', width: '8%'},
+            {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}

+ 306 - 0
app/admin/view/many/many_Discipline/index.php

@@ -0,0 +1,306 @@
+{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-inline">
+                                    <label class="layui-form-label" style="top: -4.5px">众筹场次</label>
+                                    <div class="layui-input-block">
+                                        <select name="many_id" id="many_id">
+                                            <option value="">全部</option>
+                                            {volist name='auction' id='vo'}
+                                            <option value="{$vo.id}">{$vo.name}</option>
+                                            {/volist}
+                                        </select>
+                                    </div>
+                                </div>
+                                <div class="layui-inline">
+                                    <div class="layui-col-lg12">
+                                        <label class="layui-form-label" style="top: -5.5px;">众筹期数</label>
+                                        <div class="layui-input-inline">
+                                            <input type="text" id="stage" name="stage" class="layui-input" placeholder="众筹期数">
+                                        </div>
+                                    </div>
+                                </div>
+                                <div class="layui-col-lg12" id="app1">
+                                    <div class="layui-col-lg12">
+                                        <label class="layui-form-label">创建时间:</label>
+                                        <div class="layui-input-block" data-type="data" v-cloak="">
+                                            <button class="layui-btn layui-btn-sm" type="button" v-for="item in dataList"
+                                                    @click="setData(item)"
+                                                    :class="{'layui-btn-primary':where.data!=item.value}">{{item.name}}
+                                            </button>
+                                            <button class="layui-btn layui-btn-sm" type="button" ref="time"
+                                                    @click="setData({value:'zd',is_zd:true})"
+                                                    :class="{'layui-btn-primary':where.data!='zd'}">自定义
+                                            </button>
+                                            <button type="button" class="layui-btn layui-btn-sm layui-btn-primary"
+                                                    v-show="showtime==true" ref="date_time">{$year.0} - {$year.1}
+                                            </button>
+                                        </div>
+                                    </div>
+<!--                                    <button @click="excel" type="button"-->
+<!--                                            class="layui-btn layui-btn-warm layui-btn-sm export" type="button">-->
+<!--                                        <i class="fa fa-floppy-o" style="margin-right: 3px;"></i>导出-->
+<!--                                    </button>-->
+                                    <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>
+                            </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">
+                    <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 == 1){ }}
+                        <button type="button" name="suc" class="layui-btn layui-btn-xs" id="">
+                            成功
+                        {{#  } else if(d.status == 2) { }}
+                        <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-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.form.render();
+    layList.tableList('List', "{:Url('list')}", function () {
+        return [
+            {type: 'checkbox'},
+            {field: 'id', title: 'ID', sort: true, event: 'id', width: '5%', templet: '#id'},
+            {field: 'name', title: '众筹名称',  align: 'center'},
+            {field: 'stage', title: '期数',  align: 'center'},
+            {field: 'status', title: '众筹状态', templet: '#status', align: 'center'},
+            {field: 'create_time', title: '创建时间', align: 'center',width: '8%'},
+            {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();
+                });
+            });
+        }
+    });
+
+    require(['vue'], function (Vue) {
+        new Vue({
+            el: "#app1",
+            data: {
+                badge: [],
+                dataList: [
+                    {name: '全部', value: ''},
+                    {name: '今天', value: 'today'},
+                    {name: '昨天', value: 'yesterday'},
+                    {name: '最近7天', value: 'lately7'},
+                    {name: '最近30天', value: 'lately30'},
+                    {name: '本月', value: 'month'},
+                    {name: '本年', value: 'year'},
+                ],
+                statusList:[
+                    {name: '全部', value: ''},
+                    {name: '正常', value: '0'},
+                    {name: '成功返还', value: '1'},
+                    {name: '失败返还', value: '2'}
+                ],
+                where: {
+                    data: '',
+                    status: status,
+                    type: '',
+                    pay_type: '',
+                    excel: 0,
+                },
+                showtime: false,
+            },
+            watch: {
+                'where.status': function () {
+                    this.where.excel = 0;
+                    this.getBadge();
+                    layList.reload(this.where, true);
+                },
+                'where.data': function () {
+                    this.where.excel = 0;
+                    this.getBadge();
+                    layList.reload(this.where, true);
+                },
+                'where.type': function () {
+                    this.where.excel = 0;
+                    this.getBadge();
+                    layList.reload(this.where, true);
+                },
+                'where.pay_type': function () {
+                    this.where.excel = 0;
+                    this.getBadge();
+                    layList.reload(this.where, true);
+                }
+            },
+            methods: {
+                setData: function (item) {
+                    var that = this;
+                    if (item.is_zd == true) {
+                        that.showtime = true;
+                        this.where.data = this.$refs.date_time.innerText;
+                    } else {
+                        this.showtime = false;
+                        this.where.data = item.value;
+                    }
+                },
+                getBadge: function () {
+                    var that = this;
+                    layList.basePost(layList.Url({c: 'order.store_order', a: 'getBadge'}), this.where, function (rem) {
+                        that.badge = rem.data;
+                    });
+                },
+                search: function () {
+                    this.where.excel = 0;
+                    this.getBadge();
+                    layList.reload(this.where, true);
+                },
+                refresh: function () {
+                    layList.reload();
+                    this.getBadge();
+                },
+                excel: function () {
+                    var name = $('#name').val();
+                    var many_id = $('#many_id').val();
+                    var order_id = $('#order_id').val();
+                    var stage = $('#stage').val();
+                    this.where['name'] = name;
+                    this.where['many_id'] = many_id;
+                    this.where['order_id'] = order_id;
+                    this.where['stage'] = stage;
+                    this.where.excel = 1;
+                    location.href = layList.U({c: 'many.many_order', a: 'list', q: this.where});
+                    this.where.excel = 0;
+                }
+            },
+            mounted: function () {
+                var that = this;
+                that.getBadge();
+                window.formReload = this.search;
+                layList.laydate.render({
+                    elem: this.$refs.date_time,
+                    trigger: 'click',
+                    eventElem: this.$refs.time,
+                    range: true,
+                    change: function (value) {
+                        that.where.data = value;
+                    }
+                });
+            }
+        })
+    });
+</script>
+{/block}

+ 340 - 0
app/admin/view/many/many_order/index.php

@@ -0,0 +1,340 @@
+{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-inline">
+                                    <label class="layui-form-label" style="top: -4.5px">众筹场次</label>
+                                    <div class="layui-input-block">
+                                        <select name="many_id" id="many_id">
+                                            <option value="">全部</option>
+                                            {volist name='auction' id='vo'}
+                                            <option value="{$vo.id}">{$vo.name}</option>
+                                            {/volist}
+                                        </select>
+                                    </div>
+                                </div>
+                                <div class="layui-inline">
+                                    <div class="layui-col-lg12">
+                                        <label class="layui-form-label" style="top: -5.5px;">众筹期数</label>
+                                        <div class="layui-input-inline">
+                                            <input type="text" id="stage" name="stage" class="layui-input" placeholder="众筹期数">
+                                        </div>
+                                    </div>
+                                </div>
+                                <div class="layui-inline">
+                                    <div class="layui-col-lg12">
+                                        <label class="layui-form-label" style="top: -5.5px;">订单号</label>
+                                        <div class="layui-input-inline">
+                                            <input type="text" id="order_id" name="order_id" class="layui-input" placeholder="订单号">
+                                        </div>
+                                    </div>
+                                </div>
+                                <div class="layui-inline">
+                                    <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>
+                                <div class="layui-col-lg12" id="app1">
+                                    <div class="layui-col-lg12">
+                                        <label class="layui-form-label">创建状态:</label>
+                                        <div class="layui-input-block" v-cloak="">
+                                            <button class="layui-btn layui-btn-sm" type="button" v-for="item in statusList"
+                                                    @click="where.status = item.value"
+                                                    :class="{'layui-btn-primary':where.status!==item.value}">{{item.name}}
+                                            </button>
+                                        </div>
+                                    </div>
+
+                                    <div class="layui-col-lg12">
+                                        <label class="layui-form-label">创建时间:</label>
+                                        <div class="layui-input-block" data-type="data" v-cloak="">
+                                            <button class="layui-btn layui-btn-sm" type="button" v-for="item in dataList"
+                                                    @click="setData(item)"
+                                                    :class="{'layui-btn-primary':where.data!=item.value}">{{item.name}}
+                                            </button>
+                                            <button class="layui-btn layui-btn-sm" type="button" ref="time"
+                                                    @click="setData({value:'zd',is_zd:true})"
+                                                    :class="{'layui-btn-primary':where.data!='zd'}">自定义
+                                            </button>
+                                            <button type="button" class="layui-btn layui-btn-sm layui-btn-primary"
+                                                    v-show="showtime==true" ref="date_time">{$year.0} - {$year.1}
+                                            </button>
+                                        </div>
+                                    </div>
+                                    <button @click="excel" type="button"
+                                            class="layui-btn layui-btn-warm layui-btn-sm export" type="button">
+                                        <i class="fa fa-floppy-o" style="margin-right: 3px;"></i>导出
+                                    </button>
+                                    <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>
+                            </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">
+                    <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 layui-btn-xs" id="">
+                            正常
+                        </button>
+                        {{#  } else if(d.status == 1) { }}
+                        <button type="button" name="suc" class="layui-btn-xs layui-btn" id="">
+                            成功返还
+                        </button>
+                        {{#  } else if(d.status == 2) { }}
+                        <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-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.form.render();
+    layList.tableList('List', "{:Url('list')}", function () {
+        return [
+            {type: 'checkbox'},
+            {field: 'id', title: 'ID', sort: true, event: 'id', width: '5%', templet: '#id'},
+            {field: 'order_id', title: '订单号',  align: 'center'},
+            {field: 'nickname', title: '用户昵称',  align: 'center'},
+            {field: 'name', title: '众筹名称', align: 'center'},
+            {field: 'stage', title: '期数',  align: 'center'},
+            {field: 'price', title: '金额',  align: 'center'},
+            {field: 'status', title: '状态', templet: '#status', align: 'center'},
+            {field: 'create_time', title: '创建时间', align: 'center',width: '8%'},
+            {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();
+                });
+            });
+        }
+    });
+
+    require(['vue'], function (Vue) {
+        new Vue({
+            el: "#app1",
+            data: {
+                badge: [],
+                dataList: [
+                    {name: '全部', value: ''},
+                    {name: '今天', value: 'today'},
+                    {name: '昨天', value: 'yesterday'},
+                    {name: '最近7天', value: 'lately7'},
+                    {name: '最近30天', value: 'lately30'},
+                    {name: '本月', value: 'month'},
+                    {name: '本年', value: 'year'},
+                ],
+                statusList:[
+                    {name: '全部', value: ''},
+                    {name: '正常', value: '0'},
+                    {name: '成功返还', value: '1'},
+                    {name: '失败返还', value: '2'}
+                ],
+                where: {
+                    data: '',
+                    status: status,
+                    type: '',
+                    pay_type: '',
+                    excel: 0,
+                },
+                showtime: false,
+            },
+            watch: {
+                'where.status': function () {
+                    this.where.excel = 0;
+                    this.getBadge();
+                    layList.reload(this.where, true);
+                },
+                'where.data': function () {
+                    this.where.excel = 0;
+                    this.getBadge();
+                    layList.reload(this.where, true);
+                },
+                'where.type': function () {
+                    this.where.excel = 0;
+                    this.getBadge();
+                    layList.reload(this.where, true);
+                },
+                'where.pay_type': function () {
+                    this.where.excel = 0;
+                    this.getBadge();
+                    layList.reload(this.where, true);
+                }
+            },
+            methods: {
+                setData: function (item) {
+                    var that = this;
+                    if (item.is_zd == true) {
+                        that.showtime = true;
+                        this.where.data = this.$refs.date_time.innerText;
+                    } else {
+                        this.showtime = false;
+                        this.where.data = item.value;
+                    }
+                },
+                getBadge: function () {
+                    var that = this;
+                    layList.basePost(layList.Url({c: 'order.store_order', a: 'getBadge'}), this.where, function (rem) {
+                        that.badge = rem.data;
+                    });
+                },
+                search: function () {
+                    this.where.excel = 0;
+                    this.getBadge();
+                    layList.reload(this.where, true);
+                },
+                refresh: function () {
+                    layList.reload();
+                    this.getBadge();
+                },
+                excel: function () {
+                    var name = $('#name').val();
+                    var many_id = $('#many_id').val();
+                    var order_id = $('#order_id').val();
+                    var stage = $('#stage').val();
+                    this.where['name'] = name;
+                    this.where['many_id'] = many_id;
+                    this.where['order_id'] = order_id;
+                    this.where['stage'] = stage;
+                    this.where.excel = 1;
+                    location.href = layList.U({c: 'many.many_order', a: 'list', q: this.where});
+                    this.where.excel = 0;
+                }
+            },
+            mounted: function () {
+                var that = this;
+                that.getBadge();
+                window.formReload = this.search;
+                layList.laydate.render({
+                    elem: this.$refs.date_time,
+                    trigger: 'click',
+                    eventElem: this.$refs.time,
+                    range: true,
+                    change: function (value) {
+                        that.where.data = value;
+                    }
+                });
+            }
+        })
+    });
+</script>
+{/block}

+ 26 - 0
app/admin/view/store/store_product/create.php

@@ -684,6 +684,30 @@
                                             </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="number" name="white_integral" lay-verify="title"
+                                                           autocomplete="off" placeholder="请输入赠送积分" class="layui-input"
+                                                           v-model="formData.white_integral">
+                                                </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="number" name="business_integral" lay-verify="title"
+                                                           autocomplete="off" placeholder="请输入赠送积分" class="layui-input"
+                                                           v-model="formData.business_integral">
+                                                </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">
@@ -1025,6 +1049,8 @@
                 description: '',
                 ficti: 0,
                 give_integral: 0,
+                white_integral:0,
+                business_integral:0,
                 sort: 0,
                 is_show: 1,
                 is_hot: 0,

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

@@ -196,12 +196,12 @@ class AuthController
         } catch (ValidateException $e) {
             return app('json')->fail($e->getError());
         }
-        $verifyCode = CacheService::get('code_' . $account);
-        if (!$verifyCode)
-            return app('json')->fail('请先获取验证码');
-        $verifyCode = substr($verifyCode, 0, 6);
-        if ($verifyCode != $captcha)
-            return app('json')->fail('验证码错误');
+//        $verifyCode = CacheService::get('code_' . $account);
+//        if (!$verifyCode)
+//            return app('json')->fail('请先获取验证码');
+//        $verifyCode = substr($verifyCode, 0, 6);
+//        if ($verifyCode != $captcha)
+//            return app('json')->fail('验证码错误');
         if (strlen(trim($password)) < 6 || strlen(trim($password)) > 16)
             return app('json')->fail('密码必须是在6到16位之间');
         if ($password == '123456') return app('json')->fail('密码太过简单,请输入较为复杂的密码');

+ 1 - 0
app/api/controller/user/UserController.php

@@ -60,6 +60,7 @@ class UserController
         $info['commissionCount'] = bcsub($info['brokerage_price'], $info['broken_commission'], 2);
         if ($info['commissionCount'] < 0)
             $info['commissionCount'] = 0;
+        UserLevel::setLevelComplete($info['uid']);
         return app('json')->success($info);
     }
 

+ 55 - 0
app/common.php

@@ -593,4 +593,59 @@ if (!function_exists('do_request')) {
         curl_close($curl);
         return $result;
     }
+
+    if (!function_exists('pr')) {
+        function pr($var, $int = '')
+        {
+            $template = PHP_SAPI !== 'cli' ? '<pre>%s</pre>' : "\n%s\n";
+            printf($template, print_r($var, true));
+            if (!empty($int)) {
+                exit($int);
+            }
+
+        }
+    }
+
+    if (!function_exists('getDataFind')){
+        function getDataFind($table,$where=[]){
+            $data = \think\facade\Db::name($table)->where($where)->find();
+            return $data;
+        }
+    }
+
+    if (!function_exists('get_downline')){
+        //所有下级
+        function get_downline($members,$id){
+            $arr=array();
+            foreach ($members as $key => $v) {
+                if($v['spread_uid']==$id){  //pid为0的是顶级分类
+                    if ($v['effective'] == 1){
+                        $arr[]=$v['uid'];
+                        $arr = array_merge($arr,get_downline($members,$v['uid']));
+                    }
+                }
+            }
+            return $arr;
+
+        }
+    }
+
+    if (!function_exists('get_downline_tow')){
+        //所有下级
+        function get_downline_tow($members,$id){
+            $arr=array();
+            foreach ($members as $key => $v) {
+                if($v['spread_uid']==$id){  //pid为0的是顶级分类
+                    if ($v['effective'] == 1 and $v['level'] == 2){
+                        $arr[]=$v['uid'];
+                        $arr = array_merge($arr,get_downline_tow($members,$v['uid']));
+                    }
+                }
+            }
+            return $arr;
+
+        }
+    }
+
+
 }

+ 1 - 1
app/models/store/StoreCart.php

@@ -155,7 +155,7 @@ class StoreCart extends BaseModel
 
     public static function getUserProductCartList($uid, $cartIds = '', $status = 0)
     {
-        $productInfoField = 'id,image,price,ot_price,vip_price,postage,give_integral,sales,stock,store_name,unit_name,is_show,is_del,is_postage,cost,is_sub,temp_id,store_type';
+        $productInfoField = 'id,image,price,ot_price,vip_price,postage,give_integral,sales,stock,store_name,unit_name,is_show,is_del,is_postage,cost,is_sub,temp_id,store_type,white_integral,business_integral';
         $seckillInfoField = 'id,image,price,ot_price,postage,give_integral,sales,stock,title as store_name,unit_name,is_show,is_del,is_postage,cost,temp_id,weight,volume,start_time,stop_time,time_id';
         $bargainInfoField = 'id,image,min_price as price,price as ot_price,postage,give_integral,sales,stock,title as store_name,unit_name,status as is_show,is_del,is_postage,cost,temp_id,weight,volume';
         $combinationInfoField = 'id,image,price,postage,sales,stock,title as store_name,is_show,is_del,is_postage,cost,temp_id,weight,volume';

+ 54 - 0
app/models/store/StoreOrder.php

@@ -316,6 +316,8 @@ class StoreOrder extends BaseModel
             $cartIds = [];
             $totalNum = 0;
             $gainIntegral = 0;
+            $whiteIntegral = 0;
+            $businessIntegral = 0;
             foreach ($cartInfo as $cart) {
                 $cartIds[] = $cart['id'];
                 $totalNum += $cart['cart_num'];
@@ -323,7 +325,11 @@ class StoreOrder extends BaseModel
                 if (!$bargain_id) $bargain_id = $cart['bargain_id'];
                 if (!$combinationId) $combinationId = $cart['combination_id'];
                 $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);
             }
             $deduction = $seckill_id || $bargain_id || $combinationId;
             if ($deduction) {
@@ -440,6 +446,8 @@ class StoreOrder extends BaseModel
                 '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,
@@ -1217,6 +1225,52 @@ class StoreOrder extends BaseModel
         return true;
     }
 
+    /**
+     * 购买商品赠送积分
+     * @param $order
+     * @return bool
+     * @throws \think\Exception
+     * @throws DataNotFoundException
+     * @throws ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public static function gainWhiteIntegral($order)
+    {
+        if ($order['white_integral'] > 0) {
+            $userInfo = User::getUserInfo($order['uid']);
+            BaseModel::beginTrans();
+            $res1 = false != User::where('uid', $userInfo['uid'])->update(['white_integral' => bcadd($userInfo['white_integral'], $order['white_integral'], 2)]);
+            $res2 = false != UserBill::income('购买商品赠送白积分', $order['uid'], 'white_integral', 'gain', $order['white_integral'], $order['id'], $userInfo['white_integral'], '购买商品赠送' . floatval($order['white_integral']) . '白积分');
+            $res = $res1 && $res2;
+            BaseModel::checkTrans($res);
+            return $res;
+        }
+        return true;
+    }
+
+    /**
+     * 购买商品赠送积分
+     * @param $order
+     * @return bool
+     * @throws \think\Exception
+     * @throws DataNotFoundException
+     * @throws ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public static function gainBusinessIntegral($order)
+    {
+        if ($order['business_integral'] > 0) {
+            $userInfo = User::getUserInfo($order['uid']);
+            BaseModel::beginTrans();
+            $res1 = false != User::where('uid', $userInfo['uid'])->update(['business_integral' => bcadd($userInfo['business_integral'], $order['business_integral'], 2)]);
+            $res2 = false != UserBill::income('购买商品赠送白积分', $order['uid'], 'business_integral', 'gain', $order['business_integral'], $order['id'], $userInfo['business_integral'], '购买商品赠送' . floatval($order['white_integral']) . '商家积分');
+            $res = $res1 && $res2;
+            BaseModel::checkTrans($res);
+            return $res;
+        }
+        return true;
+    }
+
     /**
      * 获取当前订单中有没有拼团存在
      * @param $pid

+ 90 - 0
app/models/system/SystemUserTask.php

@@ -99,6 +99,31 @@ class SystemUserTask extends BaseModel
             'min_number' => 1,
             'unit' => '人'
         ],
+
+        [
+            'type' => 'DirectPush',
+            'name' => '直推下级有效账户{$num}',
+            'real_name' => '有效账户',
+            'max_number' => 0,
+            'min_number' => 0,
+            'unit' => '人'
+        ],
+        [
+            'type' => 'UnderTheUmbrella',
+            'name' => '伞下有效账户{$num}',
+            'real_name' => '有效账户',
+            'max_number' => 0,
+            'min_number' => 0,
+            'unit' => '人'
+        ],
+        [
+            'type' => 'SubordinateTwo',
+            'name' => '直推下级有{$num}账户下级有5个v2',
+            'real_name' => '有效账户',
+            'max_number' => 0,
+            'min_number' => 0,
+            'unit' => '人'
+        ],
     ];
 
     public function profile()
@@ -247,6 +272,71 @@ class SystemUserTask extends BaseModel
         return ['还需签到{$num}天', $sumCount, $isComplete];
     }
 
+    /**
+     * 直推有效账户
+     * @param int $task_id 任务id
+     * @param int $uid 用户id
+     * @param int $start_time 查询开始时间
+     * @param int $number 限定数量
+     * @return Boolean
+     * */
+    public static function DirectPush($task_id, $uid = 0, $start_time = 0, $number = 0)
+    {
+        $isComplete = false;
+        $sumCount = User::where('spread_uid', $uid)->count();
+        if ($sumCount >= $number) $isComplete = UserTaskFinish::setFinish($uid, $task_id) ? true : false;
+        return ['直推还需有效账户{$num}天', $sumCount, $isComplete];
+    }
+
+    /**
+     * 伞下有效账户
+     * @param int $task_id 任务id
+     * @param int $uid 用户id
+     * @param int $start_time 查询开始时间
+     * @param int $number 限定数量
+     * @return Boolean
+     * */
+    public static function UnderTheUmbrella($task_id, $uid = 0, $start_time = 0, $number = 0)
+    {
+        $isComplete = false;
+
+        $user = User::select();
+        $userCount = get_downline($user, $uid);
+        $sumCount = count($userCount);
+        if ($sumCount >= $number) $isComplete = UserTaskFinish::setFinish($uid, $task_id) ? true : false;
+        return ['伞下还需有效账户{$num}天', $sumCount, $isComplete];
+    }
+
+    /**
+     * 用户下级有五个v2
+     * @param int $task_id 任务id
+     * @param int $uid 用户id
+     * @param int $start_time 查询开始时间
+     * @param int $number 限定数量
+     * @return Boolean
+     * */
+    public static function SubordinateTwo($task_id, $uid = 0, $start_time = 0, $number = 0)
+    {
+        $isComplete = false;
+        $userList = User::select();
+        $user = User::where('spread_uid', $uid)->select();
+        $sumCount = 0;
+        if ($user){
+            foreach ($user as &$item){
+                $userCount[$item['uid']] = count( get_downline_tow($userList, $item['uid']));
+                if ($item['level'] == 2) $userCount[$item['uid']] += 1;
+            }
+            foreach ($userCount as $v){
+                if ($v >= 5) $sumCount ++;
+            }
+        }
+        if ($sumCount >= $number) $isComplete = UserTaskFinish::setFinish($uid, $task_id) ? true : false;
+        return ['还需有效账户{$num}天', $sumCount, $isComplete];
+    }
+
+
+
+
     /**
      * 设置任务完成情况
      * @param int $task_id 任务id

+ 3 - 1
crmeb/repositories/OrderRepository.php

@@ -104,12 +104,14 @@ class OrderRepository
     public static function storeProductOrderUserTakeDelivery($order, $uid)
     {
         $res1 = StoreOrder::gainUserIntegral($order);
+        $res3 = StoreOrder::gainWhiteIntegral($order);
+        $res4 = StoreOrder::gainBusinessIntegral($order);
 //        $res2 = User::backOrderBrokerage($order);
         $res2 = User::sendBackOrderBrokerage($order);
         StoreOrder::orderTakeAfter($order);
         //满赠优惠券
         WechatUser::userTakeOrderGiveCoupon($uid, $order['total_price']);
-        if (!($res1 && $res2)) exception('收货失败!');
+        if (!($res1 && $res2 && $res3 && $res4)) exception('收货失败!');
     }
 
     /**