afa 7 月之前
父节点
当前提交
d18ef72aab
共有 35 个文件被更改,包括 803 次插入498 次删除
  1. 8 12
      application/admin/command/Task.php
  2. 1 1
      application/admin/controller/product/Lists.php
  3. 5 5
      application/admin/controller/product/Popular.php
  4. 157 0
      application/admin/controller/product/Synthesis.php
  5. 1 2
      application/admin/lang/zh-cn/general/announcement.php
  6. 20 0
      application/admin/lang/zh-cn/product/synthesis.php
  7. 27 0
      application/admin/validate/Synthesis.php
  8. 14 25
      application/admin/view/general/announcement/add.html
  9. 12 25
      application/admin/view/general/announcement/edit.html
  10. 77 0
      application/admin/view/product/synthesis/add.html
  11. 77 0
      application/admin/view/product/synthesis/edit.html
  12. 35 0
      application/admin/view/product/synthesis/index.html
  13. 2 2
      application/api/controller/Airdrop.php
  14. 8 7
      application/api/controller/Announcement.php
  15. 6 6
      application/api/controller/Home.php
  16. 7 110
      application/api/controller/Ledger.php
  17. 0 44
      application/api/controller/Offline.php
  18. 4 4
      application/api/controller/Order.php
  19. 3 3
      application/api/controller/Product.php
  20. 87 0
      application/api/controller/Synthesis.php
  21. 0 153
      application/api/controller/Team.php
  22. 1 1
      application/api/logic/WelfareLoginc.php
  23. 9 24
      application/common/logic/AirdropLogic.php
  24. 2 2
      application/common/model/AnnouncementModel.php
  25. 4 4
      application/common/model/ProductArea.php
  26. 4 4
      application/common/model/ProductLists.php
  27. 2 1
      application/common/model/ProductOrder.php
  28. 12 11
      application/common/model/ProductPopular.php
  29. 5 5
      application/common/model/ProductTransfer.php
  30. 4 4
      application/common/model/ProductsModel.php
  31. 95 0
      application/common/model/Synthesis.php
  32. 9 9
      application/common/model/UserAirdrop.php
  33. 31 31
      application/common/model/UserModel.php
  34. 3 3
      public/assets/js/backend/general/announcement.js
  35. 71 0
      public/assets/js/backend/product/synthesis.js

+ 8 - 12
application/admin/command/Task.php

@@ -61,23 +61,18 @@ class Task extends Command
             $output->info("Ok Successed!");
       }
       
-      //地区导出格式
+      //山西省-大同市-平城区
+      //地区导出格式 140213  平城区   140214  云冈区
       public function execute(Input $input, Output $output){
+
+        
             $reg  =  new Region();
             $imreg=  new Importregion();
-            $list = $reg::where('ext_id', '>', 0)->chunk(1000, function($users) use($reg, $imreg) {
+            $list = $reg::where('parent_id', '=', 140214)->chunk(1000, function($users) use($reg, $imreg) {
                   foreach ($users as $user) {
 
                         switch ($user->level) {
-                              case 2:
-                                  $one = $reg::where('id',  $user->parent_id)->find(); 
-                                  $imreg::insert(['name'=> $one->name.'-'.$user->name, 'com_id'=>$one->id.'-'.$user->id, 'level'=>2]);  
-                                  break;
-                              case 3:
-                                  $two = $reg::where('id',  $user->parent_id)->find();
-                                  $one = $reg::where('id',  $two->parent_id)->find(); 
-                                  $imreg::insert(['name'=> $one->name.'-'.$two->name.'-'.$user->name, 'com_id'=>$one->id.'-'.$two->id.'-'.$user->id, 'level'=>3]);  
-                                  break;
+                    
                               case 4:
                                     $san = $reg::where('id',  $user->parent_id)->find();
                                     $two = $reg::where('id',  $san->parent_id)->find();
@@ -86,7 +81,8 @@ class Task extends Command
                                     break;
                               // 更多的 case 语句
                               default:
-                                    $imreg::insert([ 'name'=> $user->name, 'com_id'=>$user->id, 'level'=>1]);
+                                   echo "level error";
+                                   break;
 
                           }
                         //

+ 1 - 1
application/admin/controller/product/Lists.php

@@ -59,7 +59,7 @@ class Lists extends Backend
             ->paginate($limit);
         foreach ($list as &$item) {
             $item['total_num']= $this->productArea::where('product_id', $item->id)->count();
-            $item['sell_num'] = $this->productArea::where('product_id', $item->id)->where('status', $this->productArea::STOP)->count();
+            $item['sell_num'] = $this->productArea::where('product_id', $item->id)->where('status', $this->productArea::Stop)->count();
         }
 
         $result = ['total' => $list->total(), 'rows' => $list->items()];

+ 5 - 5
application/admin/controller/product/Popular.php

@@ -90,8 +90,8 @@ class Popular extends Backend
                 $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
                 $this->model->validateFailException()->validate($validate);
             }
-            if(time() >= strtotime($params['start_time'])) $params['status'] = $this->model::NORMAL;
-            if(time() >= strtotime($params['end_time'])) $params['status'] = $this->model::STOP;
+            if(time() >= strtotime($params['start_time'])) $params['status'] = $this->model::Normal;
+            if(time() >= strtotime($params['end_time'])) $params['status'] = $this->model::Stop;
             $params['num']   = 0;
             $result = $this->model->allowField(true)->save($params);
             Db::commit();
@@ -140,9 +140,9 @@ class Popular extends Backend
                 $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
                 $row->validateFailException()->validate($validate);
             }
-            if(time() < strtotime($params['start_time'])) $params['status']  = $this->model::NOTSTOP;
-            if(time() >= strtotime($params['start_time'])) $params['status'] = $this->model::NORMAL;
-            if(time() >= strtotime($params['end_time'])) $params['status']   = $this->model::STOP;
+            if(time() < strtotime($params['start_time'])) $params['status']  = $this->model::Notstop;
+            if(time() >= strtotime($params['start_time'])) $params['status'] = $this->model::Normal;
+            if(time() >= strtotime($params['end_time'])) $params['status']   = $this->model::Stop;
             $result = $row->allowField(true)->save($params);
             Db::commit();
         } catch (ValidateException|PDOException|Exception $e) {

+ 157 - 0
application/admin/controller/product/Synthesis.php

@@ -0,0 +1,157 @@
+<?php
+
+namespace app\admin\controller\product;
+
+use app\common\controller\Backend;
+use Exception;
+use think\Db;
+use think\exception\DbException;
+use think\exception\PDOException;
+use think\exception\ValidateException;
+
+/**
+ * 产品合成管理
+ *
+ * @icon fa fa-circle-o
+ */
+class Synthesis extends Backend
+{
+
+    /**
+     * Synthesis模型对象
+     * @var \app\admin\model\product\Synthesis
+     */
+    protected $model = null;
+
+    public function _initialize()
+    {
+        parent::_initialize();
+        $this->model = new \app\common\model\Synthesis;
+
+    }
+
+
+    /**
+     * 查看
+     *
+     * @return string|Json
+     * @throws \think\Exception
+     * @throws DbException
+     */
+    public function index()
+    {
+        //设置过滤方法
+        $this->request->filter(['strip_tags', 'trim']);
+        if (false === $this->request->isAjax()) {
+            return $this->view->fetch();
+        }
+        //如果发送的来源是 Selectpage,则转发到 Selectpage
+        if ($this->request->request('keyField')) {
+            return $this->selectpage();
+        }
+        [$where, $sort, $order, $offset, $limit] = $this->buildparams();
+        $list = $this->model
+            ->where($where)
+            ->order($sort, $order)
+            ->paginate($limit);
+        $result = ['total' => $list->total(), 'rows' => $list->items()];
+        return json($result);
+    }
+
+
+
+
+        /**
+     * 添加
+     *
+     * @return string
+     * @throws \think\Exception
+     */
+    public function add()
+    {
+        if (false === $this->request->isPost()) {
+            return $this->view->fetch();
+        }
+        $params = $this->request->post('row/a');
+        if (empty($params)) {
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        $params = $this->preExcludeFields($params);
+
+        if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
+            $params[$this->dataLimitField] = $this->auth->id;
+        }
+        $result = false;
+        Db::startTrans();
+        try {
+            //是否采用模型验证
+            if ($this->modelValidate) {
+                $name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
+                $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
+                $this->model->validateFailException()->validate($validate);
+            }
+            $result = $this->model->allowField(true)->save($params);
+            Db::commit();
+        } catch (ValidateException|PDOException|Exception $e) {
+            Db::rollback();
+            $this->error($e->getMessage());
+        }
+        if ($result === false) {
+            $this->error(__('No rows were inserted'));
+        }
+        $this->success();
+    }
+
+    /**
+     * 编辑
+     *
+     * @param $ids
+     * @return string
+     * @throws DbException
+     * @throws \think\Exception
+     */
+    public function edit($ids = null)
+    {
+        $row = $this->model->get($ids);
+        if (!$row) {
+            $this->error(__('No Results were found'));
+        }
+        $adminIds = $this->getDataLimitAdminIds();
+        if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
+            $this->error(__('You have no permission'));
+        }
+        if (false === $this->request->isPost()) {
+            $this->view->assign('row', $row);
+            return $this->view->fetch();
+        }
+        $params = $this->request->post('row/a');
+        if (empty($params)) {
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        $params = $this->preExcludeFields($params);
+        $result = false;
+        Db::startTrans();
+        try {
+            //是否采用模型验证
+            if ($this->modelValidate) {
+                $name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
+                $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
+                $row->validateFailException()->validate($validate);
+            }
+            $result = $row->allowField(true)->save($params);
+            Db::commit();
+        } catch (ValidateException|PDOException|Exception $e) {
+            Db::rollback();
+            $this->error($e->getMessage());
+        }
+        if (false === $result) {
+            $this->error(__('No rows were updated'));
+        }
+        $this->success();
+    }
+
+
+
+
+
+}

+ 1 - 2
application/admin/lang/zh-cn/general/announcement.php

@@ -2,8 +2,7 @@
 
 return [
     'Type_id'        => '类型',
-    'Zh_title'    => '中文标题',
-    'En_title'    => '英文标题',
+    'Title'          => '标题',
     'Introduction'=> '信息导读',
     'Body'        => '内容',
     'Images'      => '图片',

+ 20 - 0
application/admin/lang/zh-cn/product/synthesis.php

@@ -0,0 +1,20 @@
+<?php
+
+return [
+    'Id'                 => 'ID',
+    'Title'              => '标题',
+    'Product_id'         => '产品',
+    'To_lang'            => '所属语言',
+    'Material_one'       => '合成材料1',
+    'Material_one_num'   => '材料消耗1数量',
+    'Material_two'       => '合成材料2',
+    'Material_two_num'   => '材料消耗2数量',
+    'Material_three'     => '合成材料3',
+    'Material_three_num' => '材料消耗3数量',
+    'Weigh'              => '权重',
+    'Status'             => '状态',
+    'Start_time'         => '开始时间',
+    'End_time'           => '介绍时间',
+    'Create_time'        => '创建时间',
+    'Update_time'        => '更新时间'
+];

+ 27 - 0
application/admin/validate/Synthesis.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace app\admin\validate;
+
+use think\Validate;
+
+class Synthesis extends Validate
+{
+    /**
+     * 验证规则
+     */
+    protected $rule = [
+    ];
+    /**
+     * 提示消息
+     */
+    protected $message = [
+    ];
+    /**
+     * 验证场景
+     */
+    protected $scene = [
+        'add'  => [],
+        'edit' => [],
+    ];
+    
+}

+ 14 - 25
application/admin/view/general/announcement/add.html

@@ -3,35 +3,29 @@
     
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Type_id')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-type_id" data-rule="required" data-source='[{"id":"1","title":"公告"},{"id":"2","title":"轮播图"},{"id":"3","title":"茶说"}]' data-field="title" class="form-control selectpage" name="row[type_id]" type="text" value="">
+        <div class="col-xs-12 col-sm-3">
+            <input id="c-type_id" data-rule="required" data-source='[{"id":"1","title":"公告"},{"id":"4","title":"合成公告"},{"id":"2","title":"轮播图"},{"id":"3","title":"茶说"}]' data-field="title" class="form-control selectpage" name="row[type_id]" type="text" value="">
         </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Zh_title')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-zh_title" data-rule="required" class="form-control" name="row[zh_title]" type="text" value="">
+        <label class="control-label col-xs-12 col-sm-2">{:__('所属语言')}:</label>
+        <div class="col-xs-12 col-sm-3">
+            <input id="c-to_lang" data-rule="required" data-source='[{"id":"0","title":"中文"},{"id":"1","title":"英文"}]' data-field="title" class="form-control selectpage" name="row[to_lang]" type="text" value="">
         </div>
     </div>
     <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('En_title')}:</label>
+        <label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
         <div class="col-xs-12 col-sm-8">
-            <input id="c-en_title" data-rule="required" class="form-control" name="row[en_title]" type="text" value="">
+            <input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text" value="">
         </div>
     </div>
+ 
     
     <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('中文导读')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <textarea id="c-zh_introduction" class="form-control" rows="3" name="row[zh_introduction]" cols="50"></textarea>
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('英文导读')}:</label>
+        <label class="control-label col-xs-12 col-sm-2">{:__('Introduction')}:</label>
         <div class="col-xs-12 col-sm-8">
-            <textarea id="c-en_introduction" class="form-control" rows="3" name="row[en_introduction]" cols="50"></textarea>
+            <textarea id="c-introduction" class="form-control" rows="3" name="row[introduction]" cols="50"></textarea>
         </div>
     </div>
+  
     
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Images')}:</label>
@@ -58,17 +52,12 @@
         </div>
     </div>
     <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('中文详情')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <textarea id="c-zh_body" class="form-control editor" rows="5" name="row[zh_body]" cols="50"></textarea>
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('英文详情')}:</label>
+        <label class="control-label col-xs-12 col-sm-2">{:__('详情')}:</label>
         <div class="col-xs-12 col-sm-8">
-            <textarea id="c-en_body" class="form-control editor" rows="5" name="row[en_body]" cols="50"></textarea>
+            <textarea id="c-body" class="form-control editor" rows="5" name="row[body]" cols="50"></textarea>
         </div>
     </div>
+   
     <div class="form-group layer-footer">
         <label class="control-label col-xs-12 col-sm-2"></label>
         <div class="col-xs-12 col-sm-8">

+ 12 - 25
application/admin/view/general/announcement/edit.html

@@ -3,32 +3,25 @@
 
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Type_id')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-type_id" data-rule="required" data-source='[{"id":"1","title":"公告"},{"id":"2","title":"轮播图"},{"id":"3","title":"茶说"}]' data-field="title" class="form-control selectpage" name="row[type_id]" type="text" value="{$row.type_id|htmlentities}">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Zh_title')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-zh_title" data-rule="required" class="form-control" name="row[zh_title]" type="text" value="{$row.zh_title|htmlentities}">
+        <div class="col-xs-12 col-sm-3">
+            <input id="c-type_id" data-rule="required" data-source='[{"id":"1","title":"公告"},{"id":"4","title":"合成公告"},{"id":"2","title":"轮播图"},{"id":"3","title":"茶说"}]' data-field="title" class="form-control selectpage" name="row[type_id]" type="text" value="{$row.type_id|htmlentities}">
         </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('En_title')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-en_title" data-rule="required" class="form-control" name="row[en_title]" type="text" value="{$row.en_title|htmlentities}">
+        <label class="control-label col-xs-12 col-sm-2">{:__('所属语言')}:</label>
+        <div class="col-xs-12 col-sm-3">
+            <input id="c-to_lang" data-rule="required" data-source='[{"id":"0","title":"中文"},{"id":"1","title":"英文"}]' data-field="title" class="form-control selectpage" name="row[to_lang]" type="text" value="{$row.to_lang|htmlentities}">
         </div>
     </div>
     <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('中文导读')}:</label>
+        <label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
         <div class="col-xs-12 col-sm-8">
-            <textarea id="c-zh_introduction" class="form-control" rows="3" name="row[zh_introduction]" cols="50">{$row.zh_introduction|htmlentities}</textarea>
+            <input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text" value="{$row.title|htmlentities}">
         </div>
     </div>
+
     <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('英文导读')}:</label>
+        <label class="control-label col-xs-12 col-sm-2">{:__('Introduction')}:</label>
         <div class="col-xs-12 col-sm-8">
-            <textarea id="c-en_introduction" class="form-control" rows="3" name="row[en_introduction]" cols="50">{$row.en_introduction|htmlentities}</textarea>
+            <textarea id="c-introduction" class="form-control" rows="3" name="row[introduction]" cols="50">{$row.introduction|htmlentities}</textarea>
         </div>
     </div>
     <div class="form-group">
@@ -56,15 +49,9 @@
         </div>
     </div>
     <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('中文详情')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <textarea id="c-zh_body" class="form-control editor" rows="5" name="row[zh_body]" cols="50">{$row.zh_body|htmlentities}</textarea>
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('英文详情')}:</label>
+        <label class="control-label col-xs-12 col-sm-2">{:__('详情')}:</label>
         <div class="col-xs-12 col-sm-8">
-            <textarea id="c-en_body" class="form-control editor" rows="5" name="row[en_body]" cols="50">{$row.en_body|htmlentities}</textarea>
+            <textarea id="c-body" class="form-control editor" rows="5" name="row[body]" cols="50">{$row.body|htmlentities}</textarea>
         </div>
     </div>
     <div class="form-group layer-footer">

+ 77 - 0
application/admin/view/product/synthesis/add.html

@@ -0,0 +1,77 @@
+<form id="add-form"  role="form" data-toggle="validator" method="POST" action="">
+    <div class="form-horizontal">
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
+        <div class="col-xs-12 col-sm-3">
+            <input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text" value="">
+        </div>
+        <label class="control-label col-xs-12 col-sm-2">{:__('Product_id')}:</label>
+        <div class="col-xs-12 col-sm-3">
+            <input id="c-product_id" data-rule="required" data-source="product/lists/index" data-field="zh_name" class="form-control selectpage" name="row[product_id]" type="text" value="">
+        </div>
+    </div>
+  
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('To_lang')}:</label>
+        <div class="col-xs-12 col-sm-3">
+            <input id="c-to_lang" data-rule="required" data-source='[{"id":"0","title":"中文"},{"id":"1","title":"英文"}]' data-field="title" class="form-control selectpage" name="row[to_lang]" type="text" value="">
+        </div>
+        <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
+        <div class="col-xs-12 col-sm-3">
+            <input id="c-weigh" data-rule="required" class="form-control" name="row[weigh]" type="number" value="0">
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Material_one')}:</label>
+        <div class="col-xs-12 col-sm-4">
+            <input id="c-material_one" data-rule="required" data-source="product/lists/index" data-field="zh_name" data-multiple="true" class="form-control selectpage" name="row[material_one]" type="text" value="">
+        </div>
+        <label class="control-label col-xs-12 col-sm-2">{:__('Material_one_num')}:</label>
+        <div class="col-xs-12 col-sm-2">
+            <input id="c-material_one_num" data-rule="required" min="0" class="form-control" name="row[material_one_num]" type="number" value="0">
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Material_two')}:</label>
+        <div class="col-xs-12 col-sm-4">
+            <input id="c-material_two" data-source="product/lists/index" data-field="zh_name" data-multiple="true" class="form-control selectpage" name="row[material_two]" type="text" value="">
+        </div>
+        <label class="control-label col-xs-12 col-sm-2">{:__('Material_two_num')}:</label>
+        <div class="col-xs-12 col-sm-2">
+            <input id="c-material_two_num" class="form-control" name="row[material_two_num]" type="number" value="0">
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Material_three')}:</label>
+        <div class="col-xs-12 col-sm-4">
+            <input id="c-material_three" data-source="product/lists/index" data-field="zh_name" data-multiple="true" class="form-control selectpage" name="row[material_three]" type="text" value="">
+        </div>
+        <label class="control-label col-xs-12 col-sm-2">{:__('Material_three_num')}:</label>
+        <div class="col-xs-12 col-sm-2">
+            <input id="c-material_three_num" class="form-control" name="row[material_three_num]" type="number" value="0">
+        </div>
+    </div>
+
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Start_time')}:</label>
+        <div class="col-xs-12 col-sm-3">
+            <input id="c-start_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[start_time]" type="text" value="{:date('Y-m-d H:i:s')}">
+        </div>
+        <label class="control-label col-xs-12 col-sm-2">{:__('End_time')}:</label>
+        <div class="col-xs-12 col-sm-3">
+            <input id="c-end_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[end_time]" type="text" value="{:date('Y-m-d H:i:s')}">
+        </div>
+    </div>
+  
+    <div class="form-group layer-footer">
+        <label class="control-label col-xs-12 col-sm-2"></label>
+        <div class="col-xs-12 col-sm-8">
+            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div></div>
+</form>

+ 77 - 0
application/admin/view/product/synthesis/edit.html

@@ -0,0 +1,77 @@
+<form id="edit-form" role="form" data-toggle="validator" method="POST" action="">
+    <div class="form-horizontal">
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
+        <div class="col-xs-12 col-sm-3">
+            <input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text" value="{$row.title|htmlentities}">
+        </div>
+        <label class="control-label col-xs-12 col-sm-2">{:__('Product_id')}:</label>
+        <div class="col-xs-12 col-sm-3">
+            <input id="c-product_id" data-rule="required" data-source="product/lists/index" data-field="zh_name" class="form-control selectpage" name="row[product_id]" type="text" value="{$row.product_id|htmlentities}">
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('To_lang')}:</label>
+        <div class="col-xs-12 col-sm-3">
+            <input id="c-to_lang" data-rule="required" data-source='[{"id":"0","title":"中文"},{"id":"1","title":"英文"}]' data-field="title" class="form-control selectpage" name="row[to_lang]" type="text" value="{$row.to_lang|htmlentities}">
+        </div>
+        <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
+        <div class="col-xs-12 col-sm-3">
+            <input id="c-weigh" data-rule="required" class="form-control" name="row[weigh]" type="number" value="{$row.weigh|htmlentities}">
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Material_one')}:</label>
+        <div class="col-xs-12 col-sm-4">
+            <input id="c-material_one" data-rule="required" data-source="product/lists/index" data-field="zh_name" data-multiple="true" class="form-control selectpage" name="row[material_one]" type="text" value="{$row.material_one|htmlentities}">
+        </div>
+        <label class="control-label col-xs-12 col-sm-2">{:__('Material_one_num')}:</label>
+        <div class="col-xs-12 col-sm-2">
+            <input id="c-material_one_num" data-rule="required" min="0" class="form-control" name="row[material_one_num]" type="number" value="{$row.material_one_num|htmlentities}">
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Material_two')}:</label>
+        <div class="col-xs-12 col-sm-4">
+            <input id="c-material_two" data-source="product/lists/index" data-field="zh_name" data-multiple="true" class="form-control selectpage" name="row[material_two]" type="text" value="{$row.material_two|htmlentities}">
+        </div>
+        <label class="control-label col-xs-12 col-sm-2">{:__('Material_two_num')}:</label>
+        <div class="col-xs-12 col-sm-2">
+            <input id="c-material_two_num" class="form-control" name="row[material_two_num]" type="number" value="{$row.material_two_num|htmlentities}">
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Material_three')}:</label>
+        <div class="col-xs-12 col-sm-4">
+            <input id="c-material_three" data-source="product/lists/index" data-field="zh_name" data-multiple="true" class="form-control selectpage" name="row[material_three]" type="text" value="{$row.material_three|htmlentities}">
+        </div>
+        <label class="control-label col-xs-12 col-sm-2">{:__('Material_three_num')}:</label>
+        <div class="col-xs-12 col-sm-2">
+            <input id="c-material_three_num" class="form-control" name="row[material_three_num]" type="number" value="{$row.material_three_num|htmlentities}">
+        </div>
+    </div>
+ 
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Start_time')}:</label>
+        <div class="col-xs-12 col-sm-3">
+            <input id="c-start_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[start_time]" type="text" value="{:$row.start_time?datetime($row.start_time):''}">
+        </div>
+        <label class="control-label col-xs-12 col-sm-2">{:__('End_time')}:</label>
+        <div class="col-xs-12 col-sm-3">
+            <input id="c-end_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[end_time]" type="text" value="{:$row.end_time?datetime($row.end_time):''}">
+        </div>
+    </div>
+
+    <div class="form-group layer-footer">
+        <label class="control-label col-xs-12 col-sm-2"></label>
+        <div class="col-xs-12 col-sm-8">
+            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div> 
+  </div>
+</form>

+ 35 - 0
application/admin/view/product/synthesis/index.html

@@ -0,0 +1,35 @@
+<div class="panel panel-default panel-intro">
+    {:build_heading()}
+
+    <div class="panel-body">
+        <div id="myTabContent" class="tab-content">
+            <div class="tab-pane fade active in" id="one">
+                <div class="widget-body no-padding">
+                    <div id="toolbar" class="toolbar">
+                        <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
+                        <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('product/synthesis/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
+                        <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('product/synthesis/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
+                        <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('product/synthesis/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
+                        
+
+                        <div class="dropdown btn-group {:$auth->check('product/synthesis/multi')?'':'hide'}">
+                            <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
+                            <ul class="dropdown-menu text-left" role="menu">
+                                <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
+                                <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
+                            </ul>
+                        </div>
+
+                        
+                    </div>
+                    <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
+                           data-operate-edit="{:$auth->check('product/synthesis/edit')}"
+                           data-operate-del="{:$auth->check('product/synthesis/del')}"
+                           width="100%">
+                    </table>
+                </div>
+            </div>
+
+        </div>
+    </div>
+</div>

+ 2 - 2
application/api/controller/Airdrop.php

@@ -87,13 +87,13 @@ class Airdrop extends Api
             //插入待空投记录
             $rs = UserAirdrop::insert([
                 'user_id'       =>  $this->auth->id,
-                'type_id'       =>  UserAirdrop::typeSuperWeal,
+                'type_id'       =>  UserAirdrop::TypeSuperWeal,
                 'product_id'    =>  $row->super_product_id,
                 'num'           =>  $row->super_num,
                 'address'       =>  $this->auth->address,
                 'remark'        =>  '超级福利空投',
                 'create_time'   =>time(),
-                'status'        =>UserAirdrop::NORMAL,//为0 待发放层级奖励
+                'status'        =>UserAirdrop::Normal,//为0 待发放层级奖励
             ]);
 
             Db::commit();

+ 8 - 7
application/api/controller/Announcement.php

@@ -9,22 +9,23 @@ class Announcement extends Api
 {
 
     protected array $noNeedLogin = ['list','show'];
-    protected string $lan = '';
+    const toLang = ['zh' => 0, 'en' => 1];
+    protected int $lan = 0;
 
     public function _initialize()
     {
         parent::_initialize();
-        $this->lan = $this->request->getLan();
+        $this->lan = self::toLang[$this->request->getLan()];
     }
 
-    //
+    //列表
     public function list(AnnouncementModel $announcementModel)
     {
         $typeId = $this->request->param('type_id', 1, 'intval');
         $paginator = $announcementModel->where('type_id', $typeId)
-            ->where('status', 1)
+            ->where('status', 1)->where('to_lang', $this->lan)
             ->order('id DESC,weigh desc')
-            ->field('id,img_url,createtime,' . $this->lan.'_title as title,'.$this->lan.'_introduction as introduction,'.$this->lan.'_body as body')
+            ->field('id,to_lang,img_url,createtime,title as title,introduction,body')
             ->paginate($this->pageSize);
         $this->success('', $this->buildResp($paginator->total(), $paginator->currentPage(), $paginator->items()));
     }
@@ -33,8 +34,8 @@ class Announcement extends Api
     {
         $info = (new AnnouncementModel)
             ->where('id', $id)
-            ->where('status', 1)
-            ->field('id,img_url,createtime,' . $this->lan.'_title as title,'.$this->lan.'_body as body')
+            ->where('status', 1)->where('to_lang', $this->lan)
+            ->field('id,img_url,to_lang,createtime,title,introduction,body')
             ->find();
         if(empty($info)){
             $this->error('公告信息不存');

+ 6 - 6
application/api/controller/Home.php

@@ -43,7 +43,7 @@ class Home extends Api
         $resp['banner_list'] = $announcement
             ->field('id,'.$this->lan.'_title as title,img_url,createtime')
             ->where('type_id', $announcement::Banner)
-            ->where('status', $announcement::NORMAL)
+            ->where('status', $announcement::Normal)
             ->limit(0,10)
             ->order('id DESC,weigh desc')
             ->select();
@@ -52,12 +52,12 @@ class Home extends Api
         $resp['notice_list'] = $announcement
             ->field('id,'.$this->lan.'_title as title,img_url,createtime')
             ->where('type_id', $announcement::Announ)
-            ->where('status', $announcement::NORMAL)
+            ->where('status', $announcement::Normal)
             ->limit(0,10)
             ->order('id DESC,weigh desc')
             ->select();
         //分类
-        $resp['type_list'] = $productsModel->where('status', $productsModel::NORMAL)
+        $resp['type_list'] = $productsModel->where('status', $productsModel::Normal)
             ->field('id,'.$this->lan.'_title as title')
             ->order('sort desc')
             ->select();    
@@ -71,7 +71,7 @@ class Home extends Api
     {
         //更新库存
         $productPopular::setUpdateStatus();
-        $resp['product_list']  = $productPopular->with('productsList')->where('product_popular.status', '<', $productPopular::STOP)
+        $resp['product_list']  = $productPopular->with('productsList')->where('product_popular.status', '<', $productPopular::Stop)
         ->order('weigh desc,start_time asc')->select(); //$this->pageSize)
         
         // 转让 
@@ -80,7 +80,7 @@ class Home extends Api
             ->join("user u", "a.user_id = u.id", "left")
             ->join("products d", "b.type_id = d.id", "left")
             ->field('a.id,'.'b.'.$this->lan.'_name as name,b.thum as img_url,price,u.nickname,d.'.$this->lan.'_title as title')
-            ->where('a.status', $productTransfer::NORMAL)
+            ->where('a.status', $productTransfer::Normal)
             ->limit(2)
             ->order('a.id DESC')
             ->select();
@@ -168,7 +168,7 @@ class Home extends Api
         $list = $productarea
             ->field('id,province,city,area,county,address')
             ->where('product_id', $pid)
-            ->where('status', $productarea::NORMAL)
+            ->where('status', $productarea::Normal)
             ->where($map)
             ->paginate($this->pageSize);
         // 提交事务

+ 7 - 110
application/api/controller/Ledger.php

@@ -49,6 +49,7 @@ class Ledger extends Api
         ];
         $this->success('', $res);
     }
+
     /**
      * 资产变动明细
      * @return void
@@ -86,10 +87,10 @@ class Ledger extends Api
                 break;
         }
         $res['data'] = $paginator->alias('a')
-        ->join('user u', 'a.from_id = u.id and a.action > 9 and a.action < 12', 'LEFT')
-        ->field('a.*, u.address')
-        ->where($where)
-        ->order('a.id DESC')->paginate($this->pageSize);
+                ->join('user u', 'a.from_id = u.id and a.action > 9 and a.action < 12', 'LEFT')
+                ->field('a.*, u.address')
+                ->where($where)
+                ->order('a.id DESC')->paginate($this->pageSize);
         $res['statusList'] = LedgerWalletModel::getStatusList();
         $this->success('',$res);
     }
@@ -118,51 +119,6 @@ class Ledger extends Api
         $this->success('',$res);
     }
 
-    public function actionGet()
-    {
-        $asset = $this->request->post('type'); // 资产类型
-        $resp  = [];
-        switch ($asset) {
-            case 1:
-                $resp = [
-                    $this->getActionValueText(Action::All),
-                    $this->getActionValueText(Action::PowerRentalPower),
-                    $this->getActionValueText(Action::PowerDirectAward),
-                    $this->getActionValueText(Action::PowerTeamAward),
-                    $this->getActionValueText(Action::PowerEqualAward),
-                    $this->getActionValueText(Action::PowerBonusAward),
-                    $this->getActionValueText(Action::PowerCommunityBonusAward),
-                ];
-                break;
-            case 2:
-                $resp = [
-                    $this->getActionValueText(Action::All),
-                    $this->getActionValueText(Action::UsdtRentalPower),
-                    $this->getActionValueText(Action::UsdtGenerateProfit),
-                    $this->getActionValueText(Action::UsdtWeightDividend),
-                    $this->getActionValueText(Action::UsdtWithdrawCash),
-                    $this->getActionValueText(Action::UsdtWithdrawReturn),
-                    $this->getActionValueText(Action::UsdtRegBonus),
-                    $this->getActionValueText(Action::UsdtCmmunityBonus),
-                ];
-                break;
-            case 3:
-                $resp = [
-                    $this->getActionValueText(Action::All),
-                    $this->getActionValueText(Action::TokenAllocateEtc),
-                ];
-                break;
-            default:
-                $this->error(__('Invalid parameters'));
-                break;
-        }
-        $this->success('', $resp);
-    }
-
-    private function getActionValueText(int $action): array
-    {
-        return ['value' => $action, 'text' => Action::getText($action)];
-    }
 
     /**
      * 茶宝赠送明细 
@@ -170,7 +126,6 @@ class Ledger extends Api
      */
     public function chabao()
     {
-      
         $this->success('', ['value' => getConfig('chabao_giveaway'), 'text' => getConfig('chabao_giveaway_txt')]);
     }
 
@@ -219,9 +174,7 @@ class Ledger extends Api
     public function tokenList()
     {
         $type  = $this->request->post('query.action'); // 账变类型
-        $where = [
-            'user_id' => $this->auth->getTokenUserID(),
-        ];
+        $where = ['user_id' => $this->auth->getTokenUserID()];
         if ($type != Action::All) {
             $where['action'] = $type;
         }
@@ -239,7 +192,6 @@ class Ledger extends Api
     {
         //post 获取过来的数据格式为:{"code":"1","data":{"orderNo":"1768","tx_hash":"xx4545"}}
         $parems = $this->request->post();
-
         Log::write('提现自动打款回调参数:','info');
         Log::info(json_encode($parems));
 
@@ -250,9 +202,7 @@ class Ledger extends Api
         if($parems['code'] != 1){
             $this->error("本次提现失败");
         }
-
         $rs_data = $parems['data'];
-
         $info = (new OfflineWithdrawRecordModel())
             ->where('id', $rs_data['orderNo'])
             ->find();
@@ -277,60 +227,7 @@ class Ledger extends Api
             }
         }
     }
-    /**
-     * 提现自动打款回调
-     * 接口回调信息格式:
-     * companyWithdrawId=126&sign=8e3c6aee53e3ea4ff974c1d80f4e8beb&status=1&txId=0x39ce05a0698ff2b7459ca707703fd48937dd958422d98ebade6b4f5188b70995
-     * @return void
-     */
-    public function withdrawCallback()
-    {
-//        $body1 = file_get_contents("php://input");
-//        Log::write('提现自动打款回调1:' . $body1, 'info');
-//
-//        $body  = $this->request->post();
-        $body  = file_get_contents("php://input");
-        //$body  = 'companyWithdrawId=126&sign=8e3c6aee53e3ea4ff974c1d80f4e8beb&status=1&txId=0x39ce05a0698ff2b7459ca707703fd48937dd958422d98ebade6b4f5188b70995';
-        Log::write('提现自动打款回调:' . $body, 'info');
-
-        if(empty($body)){
-            return;
-        }
-        $parems = explode('&', $body);
-
-        $req_arr = [];
-        foreach ($parems as $item){
-            $temp = explode('=', $item);
-            $req_arr[$temp[0]] = $temp[1];
-        }
-        Log::write('提现自动打款回调参数:','info');
-        Log::info(json_encode($req_arr));
-
-        $info = (new OfflineWithdrawRecordModel())
-            ->where('id', $req_arr['companyWithdrawId'])
-            ->find();
-        if(empty($info)){
-            $this->error("当前提现信息不存在");
-        }
-        if($info['status'] == OfflineWithdrawRecordModel::StatusSuccessAuto){
-            $this->success("更新成功");
-        }
-        if($info['status'] == OfflineWithdrawRecordModel::StatusConfirm){
-            $is_update = (new OfflineWithdrawRecordModel())
-                ->where('id', $req_arr['companyWithdrawId'])
-                ->update([
-                    'tx_hash'       => $req_arr['txId'],
-                    'status'        => OfflineWithdrawRecordModel::StatusSuccessAuto,
-                    'update_time'   => time(),
-                ]);
-            if($is_update){
-                $this->success("更新成功");
-            }else{
-                $this->error("更新失败");
-            }
-        }
-    }
-
+   
     // 获取充值地址
     public function getAddress()
     {   

+ 0 - 44
application/api/controller/Offline.php

@@ -93,7 +93,6 @@ class Offline extends Api
             Db::rollback();
             $this->error( $e->getMessage());
         }
-
         $this->success('ok');
     }
 
@@ -135,49 +134,6 @@ class Offline extends Api
     }
 
 
-    //post
-    private static  function curlPostData($url , $data=array())
-    {
-        $headers = array("Content-type:application/x-www-form-urlencoded;charset=UTF-8");
-        $ch = curl_init();
-        curl_setopt($ch, CURLOPT_URL, $url);
-        curl_setopt($ch, CURLOPT_HTTPHEADER,$headers);
-        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
-        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
-        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
-        // POST数据
-        curl_setopt($ch, CURLOPT_POST, 1);
-        // 把post的变量加上
-        curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
-        $output = curl_exec($ch);
-        curl_close($ch);
-        return $output;
-    }
-
-    //get
-    private static function curlGetData($url){
-        Log::info('查询余额');
-        Log::info($url);
-        # 初始化一个curl会话
-        $ch = curl_init();
-        # 判断是否是https
-        if (stripos($url, "https://") !== false) {
-            # 禁用后cURL将终止从服务端进行验证
-            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
-            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
-            # 	使用的SSL版本(2 或 3)
-            curl_setopt($ch, CURLOPT_SSLVERSION, 1);
-        }
-        # 设置请求地址
-        curl_setopt($ch, CURLOPT_URL, $url);
-        # 	在启用CURLOPT_RETURNTRANSFER的时候,返回原生的(Raw)输出
-        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 
-        # 执行这个请求
-        $output = curl_exec($ch);
-        # 关闭这个请求
-        curl_close($ch);
-        return $output;
-    }
 
 }

+ 4 - 4
application/api/controller/Order.php

@@ -67,7 +67,7 @@ class Order extends Api
             //更新Rwa持有数量
             if($order_info->price > config('min_rwa_price')) $userModel::updateForRwaNum($this->auth->id, $this->auth->parent_id, $areaNum, '+');
             //扣除库存
-            if(($order_info->stock - $areaNum) == 0 || time() >= $order_info->end_time) $order_info->status= $productPopular::STOP;
+            if(($order_info->stock - $areaNum) == 0 || time() >= $order_info->end_time) $order_info->status= $productPopular::Stop;
             $order_info->num  += $areaNum;
             $order_info->save();
             if (false === $result) $this->error(__('No rows were updated'));
@@ -166,7 +166,7 @@ class Order extends Api
         //启动事务
         Db::startTrans();
         try {
-            $order_info = $productTransfer->where('id', $params['order_id'])->where('status', $productTransfer::NORMAL)->find();
+            $order_info = $productTransfer->where('id', $params['order_id'])->where('status', $productTransfer::Normal)->find();
             if(empty($order_info)) throw new Exception(__("订单不存在"));
             if($order_info['user_id'] == $this->auth->id) throw new Exception(__("不能购买自己寄售的商品"));
             $chabao = $ledgerWalletModel::getWalletChaBao($this->auth->id);
@@ -197,7 +197,7 @@ class Order extends Api
             $popular_order->save();
 
             //修改状态
-            $order_info->status = $productTransfer::STOP;
+            $order_info->status = $productTransfer::Stop;
             $order_info->save();
             Db::commit();
         } catch (Exception $e) {
@@ -270,7 +270,7 @@ class Order extends Api
             if(empty($order_info)) throw new Exception(__("参数有误,无可用产品"));
 
             //转让列表取消
-            $productTransfer::where('order_id',$params['order_id'])->setField('status', $productTransfer::STOP);
+            $productTransfer::where('order_id',$params['order_id'])->setField('status', $productTransfer::Stop);
 
             //新增记录
             $productOrder::setCreateOrder($order_info['order_id'], $order_info, $productOrder::Popular, $order_info['user_id'], $order_info['from_user'], $order_info->order_no, 0, $order_info->popular_price);

+ 3 - 3
application/api/controller/Product.php

@@ -34,11 +34,11 @@ class Product extends Api
             $list=  $productLists->where('type_id', $kk)->field('id,thum as img_url,'.$this->lan.'_name as name')->select();
             $i = 0;
             $proArr  = array();
-            foreach ($list as $key => &$item) {
+            foreach ($list as &$item) {
                 $pro =$productPopular
                     ->field('id,product_id,price,cost_price,stock,(num+init_num) as num,start_time,end_time,status')
                     ->where('product_id', $item['id'])
-                    ->where('status', '<', $productPopular::STOP)
+                    ->where('status', '<', $productPopular::Stop)
                     ->order('start_time')
                     ->find();
                 if(!empty($pro)){
@@ -79,7 +79,7 @@ class Product extends Api
             ->join("products d", "b.type_id = d.id", "left")
             ->join("product_area dr", "dr.id = a.area_id", "left") //地区
             ->field('a.id,'.'b.'.$this->lan.'_name as name,b.thum as img_url,price,u.nickname,d.'.$this->lan.'_title as title,dr.address')
-            ->where('a.status', $productTransfer::NORMAL)
+            ->where('a.status', $productTransfer::Normal)
             ->where($map)
             ->order($order)
             ->paginate($this->pageSize);

+ 87 - 0
application/api/controller/Synthesis.php

@@ -0,0 +1,87 @@
+<?php
+
+
+namespace app\api\controller;
+
+use app\common\controller\Api;
+use app\common\model\UserModel;
+use app\common\model\UserPathModel;
+use app\common\model\Synthesis as SynthesisModel;
+use fast\Action;
+use fast\Asset;
+use fast\Http;
+use think\Db;
+use think\Log;
+
+
+//合成管理
+class Synthesis extends Api
+{
+
+
+    public function list(SynthesisModel $synthesis)
+    {
+        $list = $synthesis->alias('a')
+        ->join("product_list b", "a.product_id = b.id", "left")
+        ->join("user u", "a.user_id = u.id", "left")
+        ->join("products d", "b.type_id = d.id", "left")
+        ->join("product_area dr", "dr.id = a.area_id", "left") //地区
+        ->field('a.id,'.'b.'.$this->lan.'_name as name,b.thum as img_url,price,u.nickname,d.'.$this->lan.'_title as title,dr.address')
+        ->where('a.status', $synthesis::Normal)
+        ->where($map)
+        ->order($order)
+        ->paginate($this->pageSize);
+    $this->success('', $list);
+    }
+
+
+    /*
+     * 更新上级
+     */
+    public function change_parent()
+    {
+        //3.更新主表会员上级
+        dump('重建网体');
+        $user_list = Db::table('user_1')
+            ->order('distance')
+            ->select();
+        $i = 0;
+        foreach ($user_list as $user){
+            $parent_info = (new UserModel())
+                ->where('address', $user['parent_address'])
+                ->find();
+            if(!empty($parent_info)){
+                $is = Db::table('user')
+                    ->where('id', $user['id'])
+                    ->update([
+                        'parent_id' => $parent_info['id']
+                    ]);
+                //删除网体
+                (new UserPathModel())
+                    ->where('user_id', $user['id'])
+                    ->delete();
+
+                // 创建网体
+                (new UserPathModel())->createPath($user['id'], $parent_info['id']);
+                $i++;
+            } else{
+                dump($user['id'] . '--无上级');
+            }
+        }
+
+        halt($i);
+    }
+
+ 
+
+   
+   
+
+    
+
+   
+
+
+   
+ 
+}

+ 0 - 153
application/api/controller/Team.php

@@ -1,153 +0,0 @@
-<?php
-
-namespace app\api\controller;
-
-use app\common\controller\Api;
-use app\common\model\LedgerPowerChangeModel;
-use app\common\model\LedgerSmhChangeModel;
-use app\common\model\LedgerTokenChangeModel;
-use app\common\model\LedgerUsdtChangeModel;
-use app\common\model\OfflineRechargeRecordModel;
-use app\common\model\UserModel;
-use app\common\model\UserPathModel;
-use fast\Action;
-use fast\Date;
-use think\Db;
-use think\Model;
-
-class Team extends Api
-{
-
-    /**
-     * 团队算力收益的Action
-     * @var array
-     */
-    private array $actionPower = [Action::PowerTeamAward, Action::PowerEqualAward];
-    /**
-     * 团队USDT收益的Action
-     * @var array
-     */
-    private array $actionUsdt = [Action::UsdtWeightDividend];
-    /**
-     * 团队虚拟币收益的Action
-     * @var array
-     */
-    private array $actionSmh = [Action::TokenAllocateEtc];
-
-    /**
-     * 团队页的几项数据
-     * @return void
-     */
-    public function all()
-    {
-        $user = $this->auth->getUser();
-        $resp = [
-            'team_power'       => $user['team_power'],
-            'team_num'         => $user['team_num'],
-            'direct_num'       => $user['direct_num'],
-            'yesterday_profit' => $this->getYesterdayProfit($user['id']),
-        ];
-
-        $resp['list'] = (new UserModel())
-            ->field('id,address,team_power,team_num,create_time')
-            ->where('parent_id', $user['id'])
-            ->order('id desc')
-            ->select();
-        foreach ($resp['list'] as $key => $item){
-            //统计团队人数
-            $resp['list'][$key]['user_power'] = (new OfflineRechargeRecordModel())
-                ->where('user_id', $item['id'])
-                ->where('status', OfflineRechargeRecordModel::StatusSuccess)
-                ->sum('power');
-
-            $resp['list'][$key]['address'] = substr($item['address'], 0, 4) . '****' . substr($item['address'], -4);
-            unset($resp['list'][$key]['id']);
-        }
-        $this->success('', $resp);
-
-    }
-
-    /**
-     * 获取用户昨日团队收益
-     * @param int $uid 用户ID
-     * @return array
-     */
-    private function getYesterdayProfit(int $uid): array
-    {
-        $yesterdayStart = Date::unixtime('day', -1); // 昨日0点0分0秒
-        $yesterdayEnd   = Date::unixtime() - 1; // 昨日23点59分59秒
-
-        // 算力
-        $sumPoser = (new LedgerPowerChangeModel())
-            ->where('user_id', $uid)
-            //->where('action', 'IN', $this->actionPower)
-            ->where('create_time', ['>=', $yesterdayStart], ['<=', $yesterdayEnd], 'AND')
-            ->where('change_amount', '>', 0)
-            ->sum('change_amount');
-
-        // USDT
-//        $sumUsdt = (new LedgerUsdtChangeModel())
-//            ->where('user_id', $uid)
-//            ->where('action', 'IN', $this->actionUsdt)
-//            ->where('create_time', ['>=', $yesterdayStart], ['<=', $yesterdayEnd], 'AND')
-//            ->where('change_amount', '>', 0)
-//            ->sum('change_amount');
-
-        // SMH
-        $sumSmh = (new LedgerSmhChangeModel())
-            ->where('user_id', $uid)
-            ->where('create_time', ['>=', $yesterdayStart], ['<=', $yesterdayEnd], 'AND')
-            ->where('change_amount', '>', 0)
-            ->sum('change_amount');
-
-        //昨日团队业绩
-        $yesterdayTeamPower = DB::table('team_rewards')
-            ->where('user_id', $uid)
-            ->where('date_time',  date('Y-m-d', strtotime('-1 day')))
-            ->value('team_power');
-
-        // 转成字符串型
-        return [
-            'power' => strval($sumPoser),
-            //'usdt'  => strval($sumUsdt),
-            'smh' => strval($sumSmh),
-            'team_power' => strval($yesterdayTeamPower) ? '' : 0,
-        ];
-    }
-
-    /**
-     * 团队收益列表
-     * @return void
-     */
-    public function profitList()
-    {
-        $type   = $this->request->post('query.type'); // 资产类型
-        $model  = new LedgerPowerChangeModel();
-        $action = [];
-        switch ($type) {
-            case 1:
-                $model  = new LedgerPowerChangeModel();
-                $action = $this->actionPower;
-                break;
-            case 2:
-                $model  = new LedgerUsdtChangeModel();
-                $action = $this->actionUsdt;
-                break;
-            case 3:
-                $model  = new LedgerTokenChangeModel();
-                $action = $this->actionToken;
-                break;
-            default:
-                $this->error('资产类型错误');
-                break;
-        }
-        $where     = [
-            'user_id' => $this->auth->getTokenUserID(),
-            'action'  => ['IN', $action],
-        ];
-        $paginator = $model->where($where)->order('id DESC')->paginate($this->pageSize);
-        $this->success('', $this->buildResp($paginator->total(), $paginator->currentPage(), $paginator->items()));
-    }
-
-
-}

+ 1 - 1
application/api/logic/WelfareLoginc.php

@@ -140,7 +140,7 @@ class WelfareLoginc
             $result = ProductOrder::setPopularNoAreaOrder($num, $orderId, $price, $productId, $uid, $typeId);
         }else{
             // 需要区域信息,首先查询符合条件的区域ID
-            $areaArr = ProductArea::where('product_id', $productId)->where('status', ProductArea::NORMAL)->orderRaw('id desc')->limit($num)->column('id');
+            $areaArr = ProductArea::where('product_id', $productId)->where('status', ProductArea::Normal)->orderRaw('id desc')->limit($num)->column('id');
             // 使用查询到的区域ID调用相应的方法设置订单
             $result =  ProductOrder::setPopularAreaOrder($areaArr, $orderId, $price, $productId, $uid, $typeId);
         }

+ 9 - 24
application/common/logic/AirdropLogic.php

@@ -45,7 +45,7 @@ class AirdropLogic
     public function setAirdropRewards()
     {
         //查找会员资产列表
-        $info_list = UserAirdrop::where('type_id', UserAirdrop::typeRwa)->where('status', UserAirdrop::NORMAL)->find();    
+        $info_list = UserAirdrop::where('type_id', UserAirdrop::TypeRwa)->where('status', UserAirdrop::Normal)->find();    
         if(empty($info_list)){
             (new Output())->writeln("本次没有空投发放数据:");
             return false;
@@ -70,7 +70,7 @@ class AirdropLogic
         );
 
         // 更新信息列表的状态和备注
-        $info_list->status = UserAirdrop::STOP;
+        $info_list->status = UserAirdrop::Stop;
         $info_list->remark = '总发放'.$info_list->total_num.'套';
 
         // 保存更新后的信息列表
@@ -87,9 +87,9 @@ class AirdropLogic
     public function setParentRewards()
     {
         //
-        $info = UserAirdrop::where('type_id', UserAirdrop::typeSuperWeal)
+        $info = UserAirdrop::where('type_id', UserAirdrop::TypeSuperWeal)
             ->where('user_id', '>', 0)
-            ->where('status', UserAirdrop::NORMAL)
+            ->where('status', UserAirdrop::Normal)
             ->find();
         if(empty($info)){
             (new Output())->writeln("本次没有层级奖励数据:");
@@ -113,11 +113,11 @@ class AirdropLogic
 
         $user_info = UserModel::where('id', $info['user_id'])->find();
         if($user_info->address_level == 0){
-            (new UserAirdrop)->updateDate($info['id'], UserAirdrop::STOP, '会员未领超级福利');
+            (new UserAirdrop)->updateDate($info['id'], UserAirdrop::Stop, '会员未领超级福利');
             return false;
         }
         if($user_info->parent_id == 0){
-            (new UserAirdrop)->updateDate($info['id'], UserAirdrop::STOP, '会员无上级');
+            (new UserAirdrop)->updateDate($info['id'], UserAirdrop::Stop, '会员无上级');
             return false;
         }
         $parents_info = UserPathModel::where('p.user_id', $info['user_id'])
@@ -128,7 +128,7 @@ class AirdropLogic
             ->order('p.distance asc')
             ->select();
         if(empty($parents_info)){
-            (new UserAirdrop)->updateDate($info['id'], UserAirdrop::STOP, '所有上级无超级福利');
+            (new UserAirdrop)->updateDate($info['id'], UserAirdrop::Stop, '所有上级无超级福利');
         }
         $level = 0;
         $send_user_ids = [];//需要发放的会员ID列表
@@ -141,7 +141,7 @@ class AirdropLogic
             }
         }
         if(empty($send_user_ids)){
-            (new UserAirdrop)->updateDate($info['id'], UserAirdrop::STOP, '所有上级都未满足发放条件');
+            (new UserAirdrop)->updateDate($info['id'], UserAirdrop::Stop, '所有上级都未满足发放条件');
             return false;
         }
 
@@ -163,7 +163,7 @@ class AirdropLogic
         }
 
         // 更新信息列表的状态和备注
-        $info->status = UserAirdrop::STOP;
+        $info->status = UserAirdrop::Stop;
         $info->remark = '共'.count($send_user_ids).'人,总发放'.count($send_user_ids) * $num.'套';
 
         // 保存更新后的信息列表
@@ -265,23 +265,8 @@ class AirdropLogic
             (new Output())->writeln("本次没有可用会员数据:" . $date);
             return $log_id;
         }
-
         $num = mt_rand(4030,4080) / 1000;//每一万算力每日获得Aleo的数量,算法为每一万算力每日产6.5个币,并从2024-9-20开始,每天递减5%
-//        $date1 = '2024-9-26';
-//        $date2 = date('Y-m-d');
-//        $diff = strtotime($date2) - strtotime($date1);
-//        // 将时间戳差转换为天数
-//        $days = floor($diff / (60 * 60 * 24));
-//        if($days > 0){
-//            //每日递减3%
-//            $num = $num * pow((1-0.03), $days);
-//        }
-//        if($num < 4){
-//            $num = $num = mt_rand(3500,4500) / 1000;//每一万算力保底3个币
-//        }
-
         $power_price = $num/10000;//每算力每日获得Aleo的数量,算法为每一万算力每日产6.5个币,并从2024-9-20开始,每天递减5%
-
         foreach ($info_list as $info) {
             $amount = ($info['power']) * $power_price;
             $check = (new LedgerQubicChangeModel())

+ 2 - 2
application/common/model/AnnouncementModel.php

@@ -24,8 +24,8 @@ class AnnouncementModel  extends Model
     const Announ         = 1;
     const Banner         = 2;
 
-    const STOP           = 2;
-    const NORMAL         = 1;
+    const Stop           = 2;
+    const Normal         = 1;
     
     //状态
     public $status_list = [

+ 4 - 4
application/common/model/ProductArea.php

@@ -26,14 +26,14 @@ class ProductArea extends Model
             'update_time_text'
       ];
     
-      const STOP           = 0;
-      const NORMAL         = 1;
+      const Stop           = 0;
+      const Normal         = 1;
   
       //状态
       public $status_list = [
           '-1'                    => '全部',
-          self::STOP              => '停用',
-          self::NORMAL            => '正常'
+          self::Stop              => '停用',
+          self::Normal            => '正常'
       ];
 
 

+ 4 - 4
application/common/model/ProductLists.php

@@ -27,14 +27,14 @@ class ProductLists extends Model
     ];
     
 
-    const STOP           = 0;
-    const NORMAL         = 1;
+    const Stop           = 0;
+    const Normal         = 1;
 
     //状态
     public $status_list = [
         '-1'                    => '全部',
-        self::STOP              => '停用',
-        self::NORMAL            => '正常'
+        self::Stop              => '停用',
+        self::Normal            => '正常'
     ];
 
     //地区

+ 2 - 1
application/common/model/ProductOrder.php

@@ -39,6 +39,7 @@ class ProductOrder extends Model
     const Newbie            = 3; //新人茶权空投
     const Super             = 4; //新人福利空投
     const Airdrop           = 5; //空投
+    const Synthesi          = 6; //合成
     /* 
      *  订单状态 '已下单', 1=>'已付款', 2=>'已转让', 3=>'提货', 4=>'已取消', 5=>'完成'];
      */
@@ -78,7 +79,7 @@ class ProductOrder extends Model
             self::setCreateOrder($orderId, $order_arr, $typeId, $uid, 0, getOrderSN('R'), 0, $price);
         }
         //修改区域状态
-        $count = ProductArea::whereIn('id', $areaArr)->setField('status', ProductLists::STOP);
+        $count = ProductArea::whereIn('id', $areaArr)->setField('status', ProductLists::Stop);
         if($count !=  count($areaArr)) $result = false;
         return $result;
     }

+ 12 - 11
application/common/model/ProductPopular.php

@@ -31,14 +31,15 @@ class ProductPopular extends Model
     ];
     
     //0未开始 1进行中 2已结束 Not started
-    const NOTSTOP        = 0;
-    const NORMAL         = 1;
-    const STOP           = 2;
+    const Notstop        = 0;
+    const Normal         = 1;
+    const Stop           = 2;
+
     //状态
     public $status_list = [
-        self::NOTSTOP           => '未开始',
-        self::STOP              => '停用',
-        self::NORMAL            => '进行中'
+        self::Notstop           => '未开始',
+        self::Stop              => '停用',
+        self::Normal            => '进行中'
     ];
 
     //刷新库存状态: status 状态0未开始 1进行中 2已结束
@@ -46,20 +47,20 @@ class ProductPopular extends Model
     {   
         $count =0;
         $time = time();
-        $list = self::where('status', '<', self::STOP)->select();
+        $list = self::where('status', '<', self::Stop)->select();
         foreach ($list as $item) 
         {
             //未开始
             if ( $item->start_time > $time)  {
-                $count += $item->allowField(true)->isUpdate(true)->save(['status'=>self::NOTSTOP]);
+                $count += $item->allowField(true)->isUpdate(true)->save(['status'=>self::Notstop]);
             }
             //进行中
             if ($time >= $item->start_time && $time < $item->end_time)  {
-                $count += $item->allowField(true)->isUpdate(true)->save(['status'=>self::NORMAL]);
+                $count += $item->allowField(true)->isUpdate(true)->save(['status'=>self::Normal]);
             }
             //已结束
             if($time >= $item->end_time){
-                $count += $item->allowField(true)->isUpdate(true)->save(['status'=>self::STOP]);
+                $count += $item->allowField(true)->isUpdate(true)->save(['status'=>self::Stop]);
             }
         }
         return $count;
@@ -73,7 +74,7 @@ class ProductPopular extends Model
             ->join("product_list b", "a.product_id = b.id", "left")
             ->field('a.id,a.product_id,'.'b.'.$lan.'_name as name,b.images as img_url,price,cost_price,stock,(num+init_num) as num,start_time,end_time,b.is_area,b.details')
             ->where('a.product_id', $product_id)
-            ->where('a.status', self::NORMAL)
+            ->where('a.status', self::Normal)
             ->find();
         if (empty($info)) {
             $info = self::alias('a')

+ 5 - 5
application/common/model/ProductTransfer.php

@@ -23,14 +23,14 @@ class ProductTransfer extends Model
         'update_time_text'
     ];
 
-    const STOP           = 0;
-    const NORMAL         = 1;
+    const Stop           = 0;
+    const Normal         = 1;
 
     //状态
     public $status_list = [
         '-1'                    => '全部',
-        self::STOP              => '停用',
-        self::NORMAL            => '正常'
+        self::Stop              => '停用',
+        self::Normal            => '正常'
     ];
 
 
@@ -50,7 +50,7 @@ class ProductTransfer extends Model
         }else{
             $rows->price  = $params['price'];
             $rows->fees   = $feeAmount;
-            $rows->status = self::NORMAL;
+            $rows->status = self::Normal;
             return $rows->save();
         }  
     }

+ 4 - 4
application/common/model/ProductsModel.php

@@ -8,14 +8,14 @@ class ProductsModel  extends Model
 {
     protected $name = "products";
 
-    const STOP           = 0;
-    const NORMAL         = 1;
+    const Stop           = 0;
+    const Normal         = 1;
 
     //状态
     public $status_list = [
         '-1'                    => '全部',
-        self::STOP              => '停用',
-        self::NORMAL            => '正常'
+        self::Stop              => '停用',
+        self::Normal            => '正常'
     ];
 
 

+ 95 - 0
application/common/model/Synthesis.php

@@ -0,0 +1,95 @@
+<?php
+
+namespace app\common\model;
+
+use think\Model;
+
+
+class Synthesis extends Model
+{
+
+    // 表名
+    protected $table = 'product_synthesis';
+    
+    // 自动写入时间戳字段
+    protected $autoWriteTimestamp = 'int';
+
+    // 定义时间戳字段名
+    protected $createTime = 'create_time';
+    protected $updateTime = 'update_time';
+    protected $deleteTime = false;
+
+
+    // 追加属性
+    protected $append = [
+        'start_time_text',
+        'end_time_text',
+        'create_time_text',
+        'update_time_text'
+    ];
+    
+    //状态 normal','hidden')
+    const Hidden           = 0;
+    const Normal           = 1;
+
+
+
+
+    protected static function init()
+    {
+        self::afterInsert(function ($row) {
+            $pk = $row->getPk();
+            $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
+        });
+    }
+
+
+    public function getStartTimeTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['start_time']) ? $data['start_time'] : '');
+        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
+    }
+
+
+    public function getEndTimeTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['end_time']) ? $data['end_time'] : '');
+        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
+    }
+
+
+    public function getCreateTimeTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['create_time']) ? $data['create_time'] : '');
+        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
+    }
+
+
+    public function getUpdateTimeTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['update_time']) ? $data['update_time'] : '');
+        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
+    }
+
+    protected function setStartTimeAttr($value)
+    {
+        return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
+    }
+
+    protected function setEndTimeAttr($value)
+    {
+        return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
+    }
+
+    protected function setCreateTimeAttr($value)
+    {
+        return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
+    }
+
+    protected function setUpdateTimeAttr($value)
+    {
+        return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
+    }
+
+
+}

+ 9 - 9
application/common/model/UserAirdrop.php

@@ -27,23 +27,23 @@ class UserAirdrop extends Model
     ];
     
     //状态
-    const STOP           = 1;
-    const NORMAL         = 0;
+    const Stop           = 1;
+    const Normal         = 0;
 
     //0指定用户 1超过Rwa数 2指定地址
-    const typeUser        = 0;
-    const typeRwa         = 1;
-    const typeAddr        = 2;
+    const TypeUser        = 0;
+    const TypeRwa         = 1;
+    const TypeAddr        = 2;
     //超级福利
-    const typeSuperWeal   = 3;
+    const TypeSuperWeal   = 3;
     //超级福利上级
-    const typeSuperParent   = 4;
+    const TypeSuperParent   = 4;
 
     //状态
     public $status_list = [
         '-1'                    => '全部',
-        self::STOP              => '停用',
-        self::NORMAL            => '正常'
+        self::Stop              => '停用',
+        self::Normal            => '正常'
     ];
 
 

+ 31 - 31
application/common/model/UserModel.php

@@ -26,16 +26,16 @@ class UserModel extends Model
 //    ];.
 
     //0未开始 1进行中 2已结束 Not started
-    const NOTSTOP        = 0;
-    const NORMAL         = 1;
-    const STOP           = 2;
+    const Notstart       = 0;
+    const Normal         = 1;
+    const Stop           = 2;
 
     const level          = [1=>3, 2=> 10, 3=>3, 4=>3];  //直推人数
-    const levelOne       = 1; 
-    const levelTwo       = 2;
-    const levelThre      = 3;
-    const levelFour      = 4;
-    const levelFive      = 5;
+    const LevelOne       = 1; 
+    const LevelTwo       = 2;
+    const LevelThre      = 3;
+    const LevelFour      = 4;
+    const LevelFive      = 5;
     protected $name = 'user';
 
 
@@ -116,28 +116,28 @@ class UserModel extends Model
                 $parent = self::where('id', $item)->find();
                 //更新等级
                 if (empty($parent->address_level)) {
-                    $parent->address_level = self::levelOne;
+                    $parent->address_level = self::LevelOne;
                 }else{
-                    if ($parent->address_level < self::levelFive) {
-                        $parentCount = self::where('parent_id', $item)->where('address_level', '>=', self::levelOne)->count();
-                        if($parentCount >= self::level[1]) $parent->address_level = self::levelTwo;
-                        if($parentCount >= self::level[2]) $parent->address_level = self::levelThre;
-                        if($parent->address_level == self::levelThre){
-                            $parentCount = self::where('parent_id', $item)->where('address_level', '>=', self::levelThre)->count();
-                            if($parentCount >= self::level[3]) $parent->address_level = self::levelFour;
+                    if ($parent->address_level < self::LevelFive) {
+                        $parentCount = self::where('parent_id', $item)->where('address_level', '>=', self::LevelOne)->count();
+                        if($parentCount >= self::level[1]) $parent->address_level = self::LevelTwo;
+                        if($parentCount >= self::level[2]) $parent->address_level = self::LevelThre;
+                        if($parent->address_level == self::LevelThre){
+                            $parentCount = self::where('parent_id', $item)->where('address_level', '>=', self::LevelThre)->count();
+                            if($parentCount >= self::level[3]) $parent->address_level = self::LevelFour;
                         }
-                        if($parent->address_level == self::levelFour) {
-                            $parentCounts = self::where('parent_id', $item)->where('address_level', '>=', self::levelFour)->count();
-                            if($parentCounts >= self::level[4]) $parent->address_level = self::levelFive;
+                        if($parent->address_level == self::LevelFour) {
+                            $parentCounts = self::where('parent_id', $item)->where('address_level', '>=', self::LevelFour)->count();
+                            if($parentCounts >= self::level[4]) $parent->address_level = self::LevelFive;
                         }
                     }
                 }
                 //更新直推领取人数
-                if($parentId == $item) $parent->direct_super +=  self::NORMAL;
+                if($parentId == $item) $parent->direct_super +=  self::Normal;
                 $parent->save();
             }
         }
-        return self::where('id', $uid)->setInc('address_level', self::NORMAL);
+        return self::where('id', $uid)->setInc('address_level', self::Normal);
     }
 
     /**
@@ -149,26 +149,26 @@ class UserModel extends Model
      * */
     public static function updateUserAddresLevel(int $uid, int $parentId)
     {   
-        $addressLevel = self::levelOne;
+        $addressLevel = self::LevelOne;
         if (!empty($parentId)) {
             $paths = UserPathModel::where('user_id', $uid)->order('distance', 'asc')->column('parent_id');
             array_unshift($paths, $uid);
             foreach ($paths as $item) 
             {
                 //更新等级
-                $parentCount = self::where('parent_id', $item)->where('is_super', '=', self::levelOne)->count();
-                if($parentCount >= self::level[1]) $addressLevel = self::levelTwo;
-                if($parentCount >= self::level[2]) $addressLevel = self::levelThre;
+                $parentCount = self::where('parent_id', $item)->where('is_super', '=', self::LevelOne)->count();
+                if($parentCount >= self::level[1]) $addressLevel = self::LevelTwo;
+                if($parentCount >= self::level[2]) $addressLevel = self::LevelThre;
 
                 //是否升级翡翠
-                if($addressLevel == self::levelThre) {
-                    $parentCounts = self::where('parent_id', $item)->where('address_level', '>=', self::levelThre)->count();
-                    if($parentCounts >= self::level[3]) $addressLevel = self::levelFour;
+                if($addressLevel == self::LevelThre) {
+                    $parentCounts = self::where('parent_id', $item)->where('address_level', '>=', self::LevelThre)->count();
+                    if($parentCounts >= self::level[3]) $addressLevel = self::LevelFour;
                 }
                 //彩宝
-                if($addressLevel == self::levelFour) {
-                    $parentCounts = self::where('parent_id', $item)->where('address_level', '>=', self::levelFour)->count();
-                    if($parentCounts >= self::level[4]) $addressLevel = self::levelFive;
+                if($addressLevel == self::LevelFour) {
+                    $parentCounts = self::where('parent_id', $item)->where('address_level', '>=', self::LevelFour)->count();
+                    if($parentCounts >= self::level[4]) $addressLevel = self::LevelFive;
                 }
                 self::where('id', $item)->setField('address_level', $addressLevel);
             }

+ 3 - 3
public/assets/js/backend/general/announcement.js

@@ -26,12 +26,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                     [   
                         {checkbox: true},
                         {field: 'id', title: __('Id')},
-                        {field: 'type_id', title: __('Type_id'), operate: 'LIKE',  searchList: {"1":__('公告'),"2":__('轮播图'),"3":__('茶说')}, formatter: Table.api.formatter.flag},
-                        {field: 'zh_title', title: __('Zh_title'), operate: 'LIKE'},
-                        {field: 'en_title', title: __('En_title'), operate: false},
+                        {field: 'type_id', title: __('Type_id'), operate: 'LIKE',  searchList: {"1":__('公告'),"2":__('轮播图'),"3":__('茶说'),"4":__('合成公告') }, formatter: Table.api.formatter.flag},
+                        {field: 'title', title: __('Title'), operate: 'LIKE'},
                         {field: 'img_url', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
                         {field: 'weigh', title: __('Weigh'), operate: false},
                         {field: 'status', title: __('Status'), searchList: {"1":__('上架'),"2":__('下架')}, formatter: Table.api.formatter.toggle},
+                        {field: 'to_lang', title: __('所属语言'), operate: false,  searchList: {0:__('中文'), 1:__('英文')}, formatter: Table.api.formatter.flag},
                         {field: 'createtime', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                         {field: 'updatetime', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                         {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}

+ 71 - 0
public/assets/js/backend/product/synthesis.js

@@ -0,0 +1,71 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
+
+    var Controller = {
+        index: function () {
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    index_url: 'product/synthesis/index' + location.search,
+                    add_url: 'product/synthesis/add',
+                    edit_url: 'product/synthesis/edit',
+                    del_url: 'product/synthesis/del',
+                    multi_url: 'product/synthesis/multi',
+                    import_url: 'product/synthesis/import',
+                    table: 'product_synthesis',
+                }
+            });
+
+            var table = $("#table");
+
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                pk: 'id',
+                sortName: 'weigh',
+                fixedColumns: true,
+                fixedRightNumber: 1,
+                columns: [
+                    [
+                        {checkbox: true},
+                        {field: 'id', title: __('Id')},
+                        {field: 'product_id', title: __('Product_id')},
+                        {field: 'title', title: __('Title')},
+                        {field: 'to_lang', title: __('To_lang'), operate: false,  searchList: {0:__('中文'), 1:__('英文')}, formatter: Table.api.formatter.flag},
+                        {field: 'material_one', title: __('Material_one'), operate: 'LIKE'},
+                        {field: 'material_one_num', title: __('Material_one_num')},
+                        {field: 'material_two', title: __('Material_two'), operate: 'LIKE'},
+                        {field: 'material_two_num', title: __('Material_two_num')},
+                        {field: 'material_three', title: __('Material_three'), operate: 'LIKE'},
+                        {field: 'material_three_num', title: __('Material_three_num')},
+                        {field: 'weigh', title: __('Weigh'), operate: false},
+                        {field: 'status', title: __('Status')},
+                        {field: 'start_time', title: __('Start_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+                        {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+                        {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+                        {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                    ]
+                ]
+            });
+
+            // 为表格绑定事件
+            Table.api.bindevent(table);
+            $(".btn-add").data("area", ["80%", "80%"]);
+            table.on('post-body.bs.table', function () {
+                $('.btn-editone').data("area", ["80%", "80%"]);
+            });
+        },
+        add: function () {
+            Controller.api.bindevent();
+        },
+        edit: function () {
+            Controller.api.bindevent();
+        },
+        api: {
+            bindevent: function () {
+                Form.api.bindevent($("form[role=form]"));
+            }
+        }
+    };
+    return Controller;
+});