zxiansheng %!s(int64=4) %!d(string=hai) anos
pai
achega
737e57a6d0
Modificáronse 69 ficheiros con 537 adicións e 8041 borrados
  1. 0 63
      common/models/DecLevelLog.php
  2. 0 70
      common/models/Declaration.php
  3. 214 214
      common/models/DeclarationLevel.php
  4. 0 129
      common/models/DeclarationPackage.php
  5. 242 242
      common/models/EmployLevel.php
  6. 0 107
      common/models/ExcelAddUser.php
  7. 0 75
      common/models/ExcelChangeBalance.php
  8. 0 61
      common/models/ExcelImport.php
  9. 0 58
      common/models/ExcelOrderShop.php
  10. 0 90
      common/models/ExcelRegInfo.php
  11. 0 73
      common/models/ExcelWithdrawPaidFalse.php
  12. 0 77
      common/models/Export.php
  13. 0 59
      common/models/ExportFile.php
  14. 0 93
      common/models/FlowBonus.php
  15. 0 82
      common/models/FlowCF.php
  16. 0 71
      common/models/FlowDeductZR.php
  17. 0 82
      common/models/FlowLX.php
  18. 0 82
      common/models/FlowReconsumePoints.php
  19. 81 81
      common/models/FlowWallet.php
  20. 0 111
      common/models/HistoryBonus.php
  21. 0 66
      common/models/ImportScore.php
  22. 0 87
      common/models/Invoice.php
  23. 0 98
      common/models/InvoiceAudit.php
  24. 0 64
      common/models/InvoiceBalanceAudit.php
  25. 0 109
      common/models/InvoiceFlow.php
  26. 0 121
      common/models/LogAdminHandle.php
  27. 0 105
      common/models/LogAdminLogin.php
  28. 0 131
      common/models/OrderDec.php
  29. 0 71
      common/models/OrderGoodsDec.php
  30. 0 129
      common/models/OrderStandard.php
  31. 0 71
      common/models/OrderStandardGoods.php
  32. 0 205
      common/models/PerfAudit.php
  33. 0 53
      common/models/PerfCompany.php
  34. 0 171
      common/models/PerfMonth.php
  35. 0 130
      common/models/PerfOrder.php
  36. 0 191
      common/models/Recharge.php
  37. 0 78
      common/models/RegInfoAudit.php
  38. 0 139
      common/models/ResendQY.php
  39. 0 88
      common/models/ResendQYAudit.php
  40. 0 61
      common/models/ScoreMonth.php
  41. 0 137
      common/models/SmsApi.php
  42. 0 149
      common/models/SmsTemplate.php
  43. 0 59
      common/models/Test.php
  44. 0 60
      common/models/TmpAreaNetwork.php
  45. 0 52
      common/models/TmpDeleteUser.php
  46. 0 47
      common/models/TmpFreezeUser.php
  47. 0 60
      common/models/TmpOldNetwork.php
  48. 0 64
      common/models/TmpOldNetworkAll.php
  49. 0 64
      common/models/TmpOldNetworkError.php
  50. 0 64
      common/models/TmpOldNetworkReplenish.php
  51. 0 60
      common/models/TmpOldUser.php
  52. 0 144
      common/models/Transfer.php
  53. 0 66
      common/models/Uploads.php
  54. 0 320
      common/models/UserBind.php
  55. 0 165
      common/models/UserBonus.php
  56. 0 74
      common/models/UserClose.php
  57. 0 171
      common/models/UserMove.php
  58. 0 479
      common/models/UserNetwork.php
  59. 0 220
      common/models/UserPerf.php
  60. 0 47
      common/models/UserPerfMonthUpdate.php
  61. 0 50
      common/models/UserPerfUpdate.php
  62. 0 59
      common/models/UserPeriodPoints.php
  63. 0 61
      common/models/UserReg.php
  64. 0 364
      common/models/UserRelation.php
  65. 0 180
      common/models/UserStatusAudit.php
  66. 0 137
      common/models/UserTeam.php
  67. 0 117
      common/models/UserTeamwork.php
  68. 0 402
      common/models/Withdraw.php
  69. 0 81
      common/models/WithdrawLevel.php

+ 0 - 63
common/models/DecLevelLog.php

@@ -1,63 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%DEC_LEVEL_LOG}}".
- *
- * @property string $ID
- * @property string $USER_ID 会员ID
- * @property string $FROM_ID 变动前的级别
- * @property string $TO_ID 变动后的级别
- * @property string $ADMIN_ID admin id
- * @property int $PERIOD_NUM 变动的期数
- * @property int $CALC_MONTH 变动的结算月
- * @property string $REMARK 备注
- * @property int $STATUS 状态
- * @property int $CREATED_AT 创建时间
- */
-class DecLevelLog extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%DEC_LEVEL_LOG}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['USER_ID', 'FROM_ID', 'TO_ID', 'PERIOD_NUM', 'CALC_MONTH', 'REMARK', 'CREATED_AT'], 'required'],
-            [['PERIOD_NUM', 'CALC_MONTH', 'STATUS', 'CREATED_AT'], 'integer'],
-            [['ID', 'USER_ID', 'FROM_ID', 'TO_ID', 'ADMIN_ID'], 'string', 'max' => 32],
-            [['REMARK'], 'string', 'max' => 4000],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_ID' => '会员ID',
-            'FROM_ID' => '变动前的级别',
-            'TO_ID' => '变动后的级别',
-            'ADMIN_ID' => '管理员id',
-            'PERIOD_NUM' => '变动的期数',
-            'CALC_MONTH' => '变动的结算月',
-            'REMARK' => '备注',
-            'STATUS' => '状态',
-            'CREATED_AT' => '创建时间',
-        ];
-    }
-}

+ 0 - 70
common/models/Declaration.php

@@ -1,70 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%DECLARATION}}".
- *
- * @property string $ID
- * @property string $USER_ID 会员ID
- * @property int $TYPE 报单类型
- * @property string $INSERT_USER_ID 首购会员ID
- * @property string $DEC_AMOUNT 报单金额
- * @property string $DEC_PV 报单PV
- * @property int $PERIOD_NUM 报单期数
- * @property int $STATUS 状态
- * @property int $CREATED_AT 创建时间
- */
-class Declaration extends \common\components\ActiveRecord
-{
-    const TYPE_FIRST_BUY = 1;   // 首购
-    const TYPE_UP_LEVEL = 2;    // 升级增购
-    const TYPE_AGAIN_BUY = 3;   // 复销
-    const TYPE_RETAIL = 4;      // 零售
-
-    const STATUS_WAITING_PAYMENT = 0;   // 等待付款状态
-    const STATUS_CAN_SETTLEMENT = 1;    // 可结算状态
-    const STATUS_DELETE = 2;            // 已删除状态
-
-    /**
-     * @inheritdoc
-     */
-    public static function tableName()
-    {
-        return '{{%DECLARATION}}';
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function rules()
-    {
-        return [
-            [['USER_ID', 'TYPE', 'PERIOD_NUM', 'CREATED_AT'], 'required'],
-            [['TYPE', 'PERIOD_NUM', 'STATUS', 'CREATED_AT'], 'integer'],
-            [['DEC_AMOUNT', 'DEC_PV'], 'number'],
-            [['ID', 'USER_ID', 'INSERT_USER_ID'], 'string', 'max' => 32],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_ID' => '会员ID',
-            'TYPE' => '报单类型',
-            'INSERT_USER_ID' => '首购会员ID',
-            'DEC_AMOUNT' => '报单金额',
-            'DEC_PV' => '报单PV',
-            'PERIOD_NUM' => '报单期数',
-            'STATUS' => '状态',
-            'CREATED_AT' => '创建时间',
-        ];
-    }
-}

+ 214 - 214
common/models/DeclarationLevel.php

@@ -1,215 +1,215 @@
-<?php
-
-namespace common\models;
-
-use common\helpers\Cache;
-use Yii;
-
-/**
- * This is the model class for table "{{%DECLARATION_LEVEL}}".
- *
- * @property string $ID
- * @property string $LEVEL_NAME 级别名称
- * @property string $PERF 累计业绩
- * @property string $QY_PERCENT 区域津贴百分比
- * @property string $QY_TOUCH_CAP 对碰封顶
- * @property string $QY_BIG_CAP 大区封顶
- * @property int $FX_MIN_DEEP 复销奖拿奖最小层数
- * @property int $FX_MAX_DEEP 复销奖拿奖最大层数
- * @property string $FX_PERCENT 复销奖百分比
- * @property int $IS_ADJUST_GIFT 是否可调整礼包
- * @property int $IS_DEC 是否可以报单
- * @property int $SORT 级别排序
- * @property string $CREATE_ADMIN 创建人
- * @property string $UPDATE_ADMIN 更新人
- * @property int $CREATED_AT 创建时间
- * @property int $UPDATED_AT 更新时间
- * @property int $GL_ODD_DEEP_ONE 奇数代数(推荐1人)
- * @property int $GL_ODD_DEEP_TWO 奇数代数(推荐2人)
- * @property int $GL_ODD_DEEP_THREE 奇数代数(推荐3人)
- * @property int $INCOME_CAP 收入封顶
- */
-class DeclarationLevel extends \common\components\ActiveRecord
-{
-    const YIN_ZUAN_LEVEL_ID = '67ABCB8C1F7D5519E055736AECE8644D';
-    const JIN_ZUAN_LEVEL_ID = '67ABCCE20A9F5553E055736AECE8644D';
-    const VIP_LEVEL_ID      = '67ABCE0ECE705575E055736AECE8644D';
-
-    /**
-     * @inheritdoc
-     */
-    public static function tableName()
-    {
-        return '{{%DECLARATION_LEVEL}}';
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function rules()
-    {
-        return [
-            [['LEVEL_NAME', 'CREATE_ADMIN', 'CREATED_AT'], 'required'],
-            [['PERF', 'QY_PERCENT', 'QY_TOUCH_CAP', 'QY_BIG_CAP', 'FX_PERCENT', 'GL_ODD_DEEP_ONE', 'GL_ODD_DEEP_TWO', 'GL_ODD_DEEP_THREE', 'INCOME_CAP'], 'number'],
-            [['FX_MIN_DEEP', 'FX_MAX_DEEP', 'IS_ADJUST_GIFT', 'IS_DEC', 'SORT', 'CREATED_AT', 'UPDATED_AT'], 'integer'],
-            [['ID', 'CREATE_ADMIN', 'UPDATE_ADMIN'], 'string', 'max' => 32],
-            [['LEVEL_NAME'], 'string', 'max' => 20],
-            [['LEVEL_NAME'], 'unique'],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'LEVEL_NAME' => '级别名称',
-            'PERF' => '累计业绩',
-            'QY_PERCENT' => '区域津贴百分比',
-            'QY_TOUCH_CAP' => '对碰封顶',
-            'QY_BIG_CAP' => '大区封顶',
-            'FX_MIN_DEEP' => '复销奖拿奖最小层数',
-            'FX_MAX_DEEP' => '复销奖拿奖最大层数',
-            'FX_PERCENT' => '复销奖百分比',
-            'IS_ADJUST_GIFT' => '是否可调整礼包',
-            'IS_DEC' => '是否可以报单',
-            'SORT' => '级别排序',
-            'CREATE_ADMIN' => '创建人',
-            'UPDATE_ADMIN' => '更新人',
-            'CREATED_AT' => '创建时间',
-            'UPDATED_AT' => '更新时间',
-            'GL_ODD_DEEP_ONE' => '奇数代数(推荐1人)',
-            'GL_ODD_DEEP_TWO' => '奇数代数(推荐2人)',
-            'GL_ODD_DEEP_THREE' => '奇数代数(推荐3人)',
-            'INCOME_CAP' => '收入封顶',
-        ];
-    }
-
-    /**
-     * 从缓存获取信息
-     * @return array|mixed|\yii\db\ActiveRecord[]
-     */
-    public static function getFromCache(){
-        $data = Yii::$app->cache->get(Cache::DEC_LEVEL_CONFIG_KEY);
-        if(!$data){
-            // 获取信息
-            $data = static::find()->where('1=1')->orderBy('PERF ASC, CREATED_AT ASC')->indexBy('ID')->asArray()->all();
-            Yii::$app->cache->set(Cache::DEC_LEVEL_CONFIG_KEY, $data);
-        }
-        return $data;
-    }
-
-    /**
-     * @return array|\yii\db\ActiveRecord[]
-     */
-    public static function getAllData(){
-        return static::find()->where('1=1')->indexBy('ID')->orderBy('SORT ASC')->asArray()->all();
-    }
-
-    /**
-     *  更新缓存
-     * @return array|\yii\db\ActiveRecord[]
-     */
-    public static function updateToCache(){
-        // 获取配置
-        $data = static::find()->where('1=1')->orderBy('PERF ASC, CREATED_AT ASC')->asArray()->indexBy('ID')->all();
-        Yii::$app->cache->set(Cache::DEC_LEVEL_CONFIG_KEY, $data);
-        return $data;
-    }
-
-    /**
-     * 通过排序获取级别
-     * @param int $sort
-     * @return mixed|\yii\db\ActiveRecord
-     */
-    public static function getLevelFromSort(int $sort){
-        $empLevels = self::getFromCache();
-        foreach($empLevels as $level){
-            if($level['SORT'] == $sort){
-                return $level;
-            }
-        }
-        return [];
-    }
-
-    /**
-     * 通过排序获取ID
-     * @param int $sort
-     * @return mixed
-     */
-    public static function getIdFromSort(int $sort){
-        $level = self::getLevelFromSort($sort);
-        return $level['ID'];
-    }
-
-    /**
-     * 获取默认级别
-     * @return mixed
-     */
-    public static function getDefaultLevelId(){
-        return self::YIN_ZUAN_LEVEL_ID;
-    }
-
-    /**
-     * 通过pv获取对应的报单级别
-     * @param $pv
-     * @return mixed
-     */
-    public static function getLevelIdFromPv($pv){
-        $levelConfig = self::getFromCache();
-        $result = self::getDefaultLevelId();
-        foreach($levelConfig as $level){
-            if($pv >= $level){
-                $result = $level['ID'];
-            }
-        }
-        return $result;
-    }
-
-    /**
-     * 通过会员ID获取报单级别ID
-     * @param $userId
-     * @return mixed
-     */
-    public static function getLevelIdFromUserId($userId){
-        $data = User::findOneAsArray('ID=:ID', [':ID'=>$userId], 'DEC_LV');
-        return $data['DEC_LV'];
-    }
-
-    /**
-     * 通过会员ID获得报单级别名称
-     * @param $userId
-     * @return string
-     */
-    public static function getLevelNameFromUserId($userId){
-        $levelId = self::getLevelIdFromUserId($userId);
-        $level = self::findOneAsArray('ID=:ID', [':ID'=>$levelId]);
-        return $level ? $level['LEVEL_NAME'] : '';
-    }
-
-    /**
-     * 通过ID获取报单级别名称
-     * @param $levelId
-     * @return mixed
-     */
-    public static function getNameById($levelId){
-        $data = self::findOneAsArray('ID=:ID', [':ID'=>$levelId]);
-        return $data['LEVEL_NAME'];
-    }
-
-    /**
-     * 奖金参数
-     */
-    public static function getBonusConfig(){
-        $allData = self::getAllData();
-        $data = [];
-        foreach ($allData as $value) {
-            $data[$value['ID']]['label'] = $value['LEVEL_NAME'];
-            $data[$value['ID']]['value'] = '【区域津贴】拿奖比例'.$value['QY_PERCENT'].'%,奖金封顶'.$value['QY_TOUCH_CAP'].'元/碰,大区封顶'.$value['QY_BIG_CAP'].'积分;【复销奖】最小层数'.$value['FX_MIN_DEEP'].',最大层数'.$value['FX_MAX_DEEP'].',拿奖比例'.$value['FX_PERCENT'].'%';
-        }
-        return $data;
-    }
+<?php
+
+namespace common\models;
+
+use common\helpers\Cache;
+use Yii;
+
+/**
+ * This is the model class for table "{{%DECLARATION_LEVEL}}".
+ *
+ * @property string $ID
+ * @property string $LEVEL_NAME 级别名称
+ * @property string $PERF 累计业绩
+ * @property string $QY_PERCENT 区域津贴百分比
+ * @property string $QY_TOUCH_CAP 对碰封顶
+ * @property string $QY_BIG_CAP 大区封顶
+ * @property int $FX_MIN_DEEP 复销奖拿奖最小层数
+ * @property int $FX_MAX_DEEP 复销奖拿奖最大层数
+ * @property string $FX_PERCENT 复销奖百分比
+ * @property int $IS_ADJUST_GIFT 是否可调整礼包
+ * @property int $IS_DEC 是否可以报单
+ * @property int $SORT 级别排序
+ * @property string $CREATE_ADMIN 创建人
+ * @property string $UPDATE_ADMIN 更新人
+ * @property int $CREATED_AT 创建时间
+ * @property int $UPDATED_AT 更新时间
+ * @property int $GL_ODD_DEEP_ONE 奇数代数(推荐1人)
+ * @property int $GL_ODD_DEEP_TWO 奇数代数(推荐2人)
+ * @property int $GL_ODD_DEEP_THREE 奇数代数(推荐3人)
+ * @property int $INCOME_CAP 收入封顶
+ */
+class DeclarationLevel extends \common\components\ActiveRecord
+{
+    const YIN_ZUAN_LEVEL_ID = '67ABCB8C1F7D5519E055736AECE8644D';
+    const JIN_ZUAN_LEVEL_ID = '67ABCCE20A9F5553E055736AECE8644D';
+    const VIP_LEVEL_ID      = '67ABCE0ECE705575E055736AECE8644D';
+
+    /**
+     * @inheritdoc
+     */
+    public static function tableName()
+    {
+        return '{{%DECLARATION_LEVEL}}';
+    }
+
+    /**
+     * @inheritdoc
+     */
+    public function rules()
+    {
+        return [
+            [['LEVEL_NAME', 'CREATE_ADMIN', 'CREATED_AT'], 'required'],
+            [['PERF', 'QY_PERCENT', 'QY_TOUCH_CAP', 'QY_BIG_CAP', 'FX_PERCENT', 'GL_ODD_DEEP_ONE', 'GL_ODD_DEEP_TWO', 'GL_ODD_DEEP_THREE', 'INCOME_CAP'], 'number'],
+            [['FX_MIN_DEEP', 'FX_MAX_DEEP', 'IS_ADJUST_GIFT', 'IS_DEC', 'SORT', 'CREATED_AT', 'UPDATED_AT'], 'integer'],
+            [['ID', 'CREATE_ADMIN', 'UPDATE_ADMIN'], 'string', 'max' => 32],
+            [['LEVEL_NAME'], 'string', 'max' => 20],
+            [['LEVEL_NAME'], 'unique'],
+            [['ID'], 'unique'],
+        ];
+    }
+
+    /**
+     * @inheritdoc
+     */
+    public function attributeLabels()
+    {
+        return [
+            'ID' => 'ID',
+            'LEVEL_NAME' => '级别名称',
+            'PERF' => '累计业绩',
+            'QY_PERCENT' => '区域津贴百分比',
+            'QY_TOUCH_CAP' => '对碰封顶',
+            'QY_BIG_CAP' => '大区封顶',
+            'FX_MIN_DEEP' => '复销奖拿奖最小层数',
+            'FX_MAX_DEEP' => '复销奖拿奖最大层数',
+            'FX_PERCENT' => '复销奖百分比',
+            'IS_ADJUST_GIFT' => '是否可调整礼包',
+            'IS_DEC' => '是否可以报单',
+            'SORT' => '级别排序',
+            'CREATE_ADMIN' => '创建人',
+            'UPDATE_ADMIN' => '更新人',
+            'CREATED_AT' => '创建时间',
+            'UPDATED_AT' => '更新时间',
+            'GL_ODD_DEEP_ONE' => '奇数代数(推荐1人)',
+            'GL_ODD_DEEP_TWO' => '奇数代数(推荐2人)',
+            'GL_ODD_DEEP_THREE' => '奇数代数(推荐3人)',
+            'INCOME_CAP' => '收入封顶',
+        ];
+    }
+
+    /**
+     * 从缓存获取信息
+     * @return array|mixed|\yii\db\ActiveRecord[]
+     */
+    public static function getFromCache(){
+        $data = Yii::$app->cache->get(Cache::DEC_LEVEL_CONFIG_KEY);
+        if(!$data){
+            // 获取信息
+            $data = static::find()->where('1=1')->orderBy('PERF ASC, CREATED_AT ASC')->indexBy('ID')->asArray()->all();
+            Yii::$app->cache->set(Cache::DEC_LEVEL_CONFIG_KEY, $data);
+        }
+        return $data;
+    }
+
+    /**
+     * @return array|\yii\db\ActiveRecord[]
+     */
+    public static function getAllData(){
+        return static::find()->where('1=1')->indexBy('ID')->orderBy('SORT ASC')->asArray()->all();
+    }
+
+    /**
+     *  更新缓存
+     * @return array|\yii\db\ActiveRecord[]
+     */
+    public static function updateToCache(){
+        // 获取配置
+        $data = static::find()->where('1=1')->orderBy('PERF ASC, CREATED_AT ASC')->asArray()->indexBy('ID')->all();
+        Yii::$app->cache->set(Cache::DEC_LEVEL_CONFIG_KEY, $data);
+        return $data;
+    }
+
+    /**
+     * 通过排序获取级别
+     * @param int $sort
+     * @return mixed|\yii\db\ActiveRecord
+     */
+    public static function getLevelFromSort(int $sort){
+        $empLevels = self::getFromCache();
+        foreach($empLevels as $level){
+            if($level['SORT'] == $sort){
+                return $level;
+            }
+        }
+        return [];
+    }
+
+    /**
+     * 通过排序获取ID
+     * @param int $sort
+     * @return mixed
+     */
+    public static function getIdFromSort(int $sort){
+        $level = self::getLevelFromSort($sort);
+        return $level['ID'];
+    }
+
+    /**
+     * 获取默认级别
+     * @return mixed
+     */
+    public static function getDefaultLevelId(){
+        return self::YIN_ZUAN_LEVEL_ID;
+    }
+
+    /**
+     * 通过pv获取对应的报单级别
+     * @param $pv
+     * @return mixed
+     */
+    public static function getLevelIdFromPv($pv){
+        $levelConfig = self::getFromCache();
+        $result = self::getDefaultLevelId();
+        foreach($levelConfig as $level){
+            if($pv >= $level){
+                $result = $level['ID'];
+            }
+        }
+        return $result;
+    }
+
+    /**
+     * 通过会员ID获取报单级别ID
+     * @param $userId
+     * @return mixed
+     */
+    public static function getLevelIdFromUserId($userId){
+        $data = User::findOneAsArray('ID=:ID', [':ID'=>$userId], 'DEC_LV');
+        return $data['DEC_LV'];
+    }
+
+    /**
+     * 通过会员ID获得报单级别名称
+     * @param $userId
+     * @return string
+     */
+    public static function getLevelNameFromUserId($userId){
+        $levelId = self::getLevelIdFromUserId($userId);
+        $level = self::findOneAsArray('ID=:ID', [':ID'=>$levelId]);
+        return $level ? $level['LEVEL_NAME'] : '';
+    }
+
+    /**
+     * 通过ID获取报单级别名称
+     * @param $levelId
+     * @return mixed
+     */
+    public static function getNameById($levelId){
+        $data = self::findOneAsArray('ID=:ID', [':ID'=>$levelId]);
+        return $data['LEVEL_NAME'];
+    }
+
+    /**
+     * 奖金参数
+     */
+    public static function getBonusConfig(){
+        $allData = self::getAllData();
+        $data = [];
+        foreach ($allData as $value) {
+            $data[$value['ID']]['label'] = $value['LEVEL_NAME'];
+            $data[$value['ID']]['value'] = '【区域津贴】拿奖比例'.$value['QY_PERCENT'].'%,奖金封顶'.$value['QY_TOUCH_CAP'].'元/碰,大区封顶'.$value['QY_BIG_CAP'].'积分;【复销奖】最小层数'.$value['FX_MIN_DEEP'].',最大层数'.$value['FX_MAX_DEEP'].',拿奖比例'.$value['FX_PERCENT'].'%';
+        }
+        return $data;
+    }
 }

+ 0 - 129
common/models/DeclarationPackage.php

@@ -1,129 +0,0 @@
-<?php
-
-namespace common\models;
-
-/**
- * This is the model class for table "{{%DECLARATION_PACKAGE}}".
- *
- * @property string $ID
- * @property string $PACKAGE_NAME 套餐名称
- * @property string $PACKAGE_NO 套餐编号
- * @property string $LEVEL_ID 所属报单级别ID
- * @property string $AMOUNT 套餐金额
- * @property string $PV 套餐PV
- * @property string $PACKAGE_CONTENT 套餐内容
- * @property string $CREATED_AT 创建时间
- * @property string $CREATE_ADMIN 创建人
- * @property string $UPDATE_ADMIN 更新人
- * @property int $UPDATED_AT 更新时间
- * @property int $IS_DEL 是否删除
- * @property int $STATUS 状态
- * @property int $DELETED_AT 删除时间
- */
-class DeclarationPackage extends \common\components\ActiveRecord
-{
-    const STATUS_NAME = [
-        1 => '已上架',
-        0 => '已下架',
-    ];
-
-
-    /**
-     * @inheritdoc
-     */
-    public static function tableName()
-    {
-        return '{{%DECLARATION_PACKAGE}}';
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function rules()
-    {
-        return [
-            [['PACKAGE_NAME','PACKAGE_NO','LEVEL_ID', 'AMOUNT', 'PV', 'PACKAGE_CONTENT', 'CREATED_AT','CREATE_ADMIN',], 'required'],
-            [['ID','LEVEL_ID','CREATE_ADMIN', 'UPDATE_ADMIN'], 'string', 'max' => 32],
-            [['PACKAGE_NAME'], 'string', 'max' => 48],
-            [['PACKAGE_NAME'], 'unique'],
-            [['AMOUNT', 'PV'], 'number'],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'PACKAGE_NAME' => '套餐名称',
-            'PACKAGE_NO' => '套餐编号',
-            'LEVEL_ID' => '所属报单级别ID',
-            'AMOUNT' => '套餐金额',
-            'PV' => '套餐PV',
-            'PACKAGE_CONTENT' => '套餐内容',
-            'CREATED_AT' => '创建时间',
-            'CREATE_ADMIN' => '创建人',
-            'UPDATE_ADMIN' => '更新人',
-            'UPDATED_AT' => '更新时间',
-            'IS_DEL' => '是否删除',
-            'STATUS' => '是否上架',
-            'DELETED_AT' => '删除时间',
-        ];
-    }
-
-    /**
-     * 判断上下架状态
-     * @param $nowStatus
-     * @param $toStatus
-     * @return string
-     */
-    public static function chkAuditStatus($nowStatus, $toStatus) {
-        $statusName = self::STATUS_NAME;
-        $msg = '当前套餐状态为【' . $statusName[$nowStatus] . '】,无法设置为【' . $statusName[$toStatus] . '】';
-        switch ($toStatus) {
-            // 下架
-            case 0:
-                if ($nowStatus == 1) {
-                    $msg = '';
-                }
-                break;
-            //上架
-            case 1:
-                if ($nowStatus == 0) {
-                    $msg = '';
-                }
-                break;
-            default:
-        }
-        return $msg;
-    }
-
-    /**
-     * @return array|\yii\db\ActiveRecord[]
-     */
-    public static function getAllData(){
-        return static::find()->where('IS_DEL=0 AND STATUS=1')->indexBy('ID')->orderBy('ID ASC')->asArray()->all();
-    }
-
-    /**
-     * 通过报单ID获取对应的报单套餐
-     * @param $levelId
-     * @return mixed
-     */
-    public static function getPackageFromLevelId($levelId){
-        return static::findAllAsArray('LEVEL_ID=:LEVEL_ID', [':LEVEL_ID'=>$levelId]);
-    }
-
-    /**
-     * 通过ID获取套餐所属报单级别ID
-     * @param $packageId
-     * @return mixed
-     */
-    public static function getLevelById($packageId){
-        $data = self::findOneAsArray('ID=:ID', [':ID'=>$packageId]);
-        return $data['LEVEL_ID'];
-    }
-}

+ 242 - 242
common/models/EmployLevel.php

@@ -1,242 +1,242 @@
-<?php
-
-namespace common\models;
-
-use common\helpers\Cache;
-use Yii;
-use yii\helpers\Json;
-
-/**
- * This is the model class for table "{{%EMPLOY_LEVEL}}".
- *
- * @property string $ID
- * @property string $LEVEL_NAME 级别名称
- * @property int $LOCATION_NUM 区数量
- * @property string $LOCATION_PERF 单区业绩
- * @property string $NEW_PERF 新增业绩
- * @property string $MIN_EMPLOY_LEVEL 几个区域内分别有几个最低什么聘级的会员
- * @property string $YC_PERCENT_ARR 育成津贴比例集合
- * @property string $CF_BASE_NUM 车房奖基数
- * @property string $CF_PERCENT 车房奖系数
- * @property string $LX_BASE_NUM 领袖奖奖基数
- * @property string $LX_PERCENT 领袖奖系数
- * @property int $SORT 排序
- * @property int $CREATED_AT 创建时间
- * @property int $UPDATED_AT 更新时间
- * @property string $CREATE_ADMIN 创建人
- * @property string $UPDATE_ADMIN 更新人
- * @property int $ICON_TYPE 图标类型
- * @property int $ICON_NUM 图标个数
- * @property int $RX_PERCENT 图标个数
- * @property string $OTHER_DEPART_PERF 去除最大部门,其它部门累计推荐业绩
- * @property int $MIN_EMPLOY_NUM 最小聘级的数量
- * @property string $LEVEL_SCORE 级别分数
- * @property string $UPGRADE_SCORE 升级分数
- */
-class EmployLevel extends \common\components\ActiveRecord
-{
-
-    const NO_LEVEL_ID = '67BE1C6C21F81B32E055736AECE8644D';
-    const JX_ZR_LEVEL_ID = 'E121497617216708615';
-    const SHX_ZJ_LEVEL_ID = '67BE82019BE524CAE055736AECE8644D';
-
-    CONST EMP_LEVEL_SORT = [
-        'NO_LEVEL' => 0,//无聘级
-        'JX_ZR_LEVEL' => 1,//见习主任
-        'ZR_LEVEL' => 2,//主任
-        'GJ_ZR_LEVEL' => 3,//高级主任
-        'JL_LEVEL' => 4,//经理
-        'GJ_JL_LEVEL' => 5,//高级经理
-        'ZJ_LEVEL' => 6,//总监
-        'GJ_ZJ_LEVEL' => 7,//高级总监
-        'SHX_ZJ_LEVEL' => 8,//首席总监
-    ];
-
-    /**
-     * @inheritdoc
-     */
-    public static function tableName()
-    {
-        return '{{%EMPLOY_LEVEL}}';
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function rules()
-    {
-        return [
-            [['LEVEL_NAME', 'CREATED_AT', 'CREATE_ADMIN'], 'required'],
-            [['LOCATION_NUM', 'SORT', 'CREATED_AT', 'UPDATED_AT', 'ICON_TYPE', 'ICON_NUM', 'MIN_EMPLOY_NUM'], 'integer'],
-            [['LOCATION_PERF', 'NEW_PERF', 'CF_BASE_NUM', 'CF_PERCENT', 'LX_BASE_NUM', 'LX_PERCENT', 'RX_PERCENT', 'OTHER_DEPART_PERF', 'LEVEL_SCORE', 'UPGRADE_SCORE'], 'number'],
-            [['ID', 'MIN_EMPLOY_LEVEL', 'CREATE_ADMIN', 'UPDATE_ADMIN'], 'string', 'max' => 32],
-            [['LEVEL_NAME'], 'string', 'max' => 20],
-            [['YC_PERCENT_ARR'], 'string', 'max' => 4000],
-            [['LEVEL_NAME'], 'unique'],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'LEVEL_NAME' => '级别名称',
-            'LOCATION_NUM' => '区数量',
-            'LOCATION_PERF' => '单区业绩',
-            'NEW_PERF' => '新增业绩',
-            'MIN_EMPLOY_LEVEL' => '几个区域内分别有几个最低什么聘级的会员',
-            'YC_PERCENT_ARR' => '育成津贴比例集合',
-            'CF_BASE_NUM' => '车房奖基数',
-            'CF_PERCENT' => '车房奖系数',
-            'LX_BASE_NUM' => '领袖奖奖基数',
-            'LX_PERCENT' => '领袖奖系数',
-            'SORT' => '排序',
-            'CREATED_AT' => '创建时间',
-            'UPDATED_AT' => '更新时间',
-            'CREATE_ADMIN' => '创建人',
-            'UPDATE_ADMIN' => '更新人',
-            'ICON_TYPE' => '图标类型',
-            'ICON_NUM' => '图标个数',
-            'RX_PERCENT' => '荣衔奖比例',
-            'OTHER_DEPART_PERF' => '去除最大部门,其它部门累计推荐业绩',
-            'LEVEL_SCORE' => '级别分数',
-            'UPGRADE_SCORE' => '升级分数',
-        ];
-    }
-
-    /**
-     * 获取全部级别以数字索引的方式展现
-     * @return array|\yii\db\ActiveRecord[]
-     */
-    public static function getAllDataWithNumIndex(){
-        $allData = static::find()->where('1=1')->orderBy('SORT ASC, CREATED_AT ASC')->indexBy('SORT')->asArray()->all();
-        foreach($allData as $key=>$data){
-            if($data['YC_PERCENT_ARR']){
-                $allData[$key]['YC_PERCENT_ARR'] = Json::decode($data['YC_PERCENT_ARR']);
-            } else{
-                $allData[$key]['YC_PERCENT_ARR'] = [0,0,0,0,0,0,0,0,0,0];
-            }
-        }
-        return $allData;
-    }
-
-    /**
-     * 获取全部配置,把育成津贴奖金比例解成数组
-     * @return array|\yii\db\ActiveRecord[]
-     */
-    public static function getAllData(){
-        $allData = static::find()->where('1=1')->orderBy('SORT ASC, CREATED_AT ASC')->indexBy('ID')->asArray()->all();
-        foreach($allData as $key=>$data){
-            if($data['YC_PERCENT_ARR']){
-                $allData[$key]['YC_PERCENT_ARR'] = Json::decode($data['YC_PERCENT_ARR']);
-            } else{
-                $allData[$key]['YC_PERCENT_ARR'] = [0,0,0,0,0,0,0,0,0,0];
-            }
-        }
-        return $allData;
-    }
-
-    /**
-     * 从缓存获取信息
-     * @return array|mixed|\yii\db\ActiveRecord[]
-     */
-    public static function getFromCache(){
-        $data = Yii::$app->cache->get(Cache::EMP_LEVEL_CONFIG_KEY);
-        if(!$data){
-            // 获取信息
-            $data = self::getAllData();
-            Yii::$app->cache->set(Cache::EMP_LEVEL_CONFIG_KEY, $data);
-        }
-        return $data;
-    }
-
-    /**
-     *  更新缓存
-     * @return array|\yii\db\ActiveRecord[]
-     */
-    public static function updateToCache(){
-        // 获取配置
-        $data = self::getAllData();
-        Yii::$app->cache->set(Cache::EMP_LEVEL_CONFIG_KEY, $data);
-        return $data;
-    }
-
-    /**
-     * 通过排序获取级别
-     * @param int $sort
-     * @return mixed
-     */
-    public static function getLevelFromSort(int $sort){
-        static $empLevels;
-        if(!$empLevels){
-            $empLevels = self::getFromCache();
-            $empLevels = array_column($empLevels, null, 'sort');
-        }
-        return $empLevels[$sort];
-    }
-
-    /**
-     * 通过排序获取ID
-     * @param int $sort
-     * @return mixed
-     */
-    public static function getIdFromSort(int $sort){
-        $level = self::getLevelFromSort($sort);
-        return $level['ID'];
-    }
-
-    /**
-     * 获取默认级别
-     * @return mixed
-     */
-    public static function getDefaultLevelId(){
-        return self::NO_LEVEL_ID;
-    }
-
-    /**
-     * 获取聘级的排序
-     * @param $id
-     * @return mixed
-     */
-    public static function getSortById($id){
-        $empLevels = self::getFromCache();
-        return $empLevels[$id]['SORT']??0;
-    }
-
-    /**
-     * 是否合格高级经理及以上级别
-     * @param $id
-     * @return bool
-     */
-    public static function chkSenior($id) {
-        if (self::getSortById($id) >= 2) return true;
-        return false;
-    }
-
-    /**
-     * 通过ID获取聘级名称
-     * @param $levelId
-     * @return mixed'
-     */
-    public static function getNameById($levelId){
-        $data = self::findOneAsArray('ID=:ID', [':ID'=>$levelId]);
-        return $data['LEVEL_NAME'];
-    }
-
-    /**
-     * 奖金参数
-     */
-    public static function getBonusConfig(){
-        $allData = self::getAllData();
-        $data = [];
-        foreach ($allData as $value) {
-            $data[$value['ID']]['label'] = $value['LEVEL_NAME'];
-            $data[$value['ID']]['value'] = '【育成津贴】按代数拿奖比例(%)'.implode(",",$value['YC_PERCENT_ARR']).';【车房养老奖】基数'.$value['CF_BASE_NUM'].',分工系数'.$value['CF_PERCENT'].';【领袖分红奖】基数'.$value['LX_BASE_NUM'].',分工系数'.$value['LX_PERCENT'];
-        }
-        return $data;
-    }
-}
+<?php
+
+namespace common\models;
+
+use common\helpers\Cache;
+use Yii;
+use yii\helpers\Json;
+
+/**
+ * This is the model class for table "{{%EMPLOY_LEVEL}}".
+ *
+ * @property string $ID
+ * @property string $LEVEL_NAME 级别名称
+ * @property int $LOCATION_NUM 区数量
+ * @property string $LOCATION_PERF 单区业绩
+ * @property string $NEW_PERF 新增业绩
+ * @property string $MIN_EMPLOY_LEVEL 几个区域内分别有几个最低什么聘级的会员
+ * @property string $YC_PERCENT_ARR 育成津贴比例集合
+ * @property string $CF_BASE_NUM 车房奖基数
+ * @property string $CF_PERCENT 车房奖系数
+ * @property string $LX_BASE_NUM 领袖奖奖基数
+ * @property string $LX_PERCENT 领袖奖系数
+ * @property int $SORT 排序
+ * @property int $CREATED_AT 创建时间
+ * @property int $UPDATED_AT 更新时间
+ * @property string $CREATE_ADMIN 创建人
+ * @property string $UPDATE_ADMIN 更新人
+ * @property int $ICON_TYPE 图标类型
+ * @property int $ICON_NUM 图标个数
+ * @property int $RX_PERCENT 图标个数
+ * @property string $OTHER_DEPART_PERF 去除最大部门,其它部门累计推荐业绩
+ * @property int $MIN_EMPLOY_NUM 最小聘级的数量
+ * @property string $LEVEL_SCORE 级别分数
+ * @property string $UPGRADE_SCORE 升级分数
+ */
+class EmployLevel extends \common\components\ActiveRecord
+{
+
+    const NO_LEVEL_ID = '67BE1C6C21F81B32E055736AECE8644D';
+    const JX_ZR_LEVEL_ID = 'E121497617216708615';
+    const SHX_ZJ_LEVEL_ID = '67BE82019BE524CAE055736AECE8644D';
+
+    CONST EMP_LEVEL_SORT = [
+        'NO_LEVEL' => 0,//无聘级
+        'JX_ZR_LEVEL' => 1,//见习主任
+        'ZR_LEVEL' => 2,//主任
+        'GJ_ZR_LEVEL' => 3,//高级主任
+        'JL_LEVEL' => 4,//经理
+        'GJ_JL_LEVEL' => 5,//高级经理
+        'ZJ_LEVEL' => 6,//总监
+        'GJ_ZJ_LEVEL' => 7,//高级总监
+        'SHX_ZJ_LEVEL' => 8,//首席总监
+    ];
+
+    /**
+     * @inheritdoc
+     */
+    public static function tableName()
+    {
+        return '{{%EMPLOY_LEVEL}}';
+    }
+
+    /**
+     * @inheritdoc
+     */
+    public function rules()
+    {
+        return [
+            [['LEVEL_NAME', 'CREATED_AT', 'CREATE_ADMIN'], 'required'],
+            [['LOCATION_NUM', 'SORT', 'CREATED_AT', 'UPDATED_AT', 'ICON_TYPE', 'ICON_NUM', 'MIN_EMPLOY_NUM'], 'integer'],
+            [['LOCATION_PERF', 'NEW_PERF', 'CF_BASE_NUM', 'CF_PERCENT', 'LX_BASE_NUM', 'LX_PERCENT', 'RX_PERCENT', 'OTHER_DEPART_PERF', 'LEVEL_SCORE', 'UPGRADE_SCORE'], 'number'],
+            [['ID', 'MIN_EMPLOY_LEVEL', 'CREATE_ADMIN', 'UPDATE_ADMIN'], 'string', 'max' => 32],
+            [['LEVEL_NAME'], 'string', 'max' => 20],
+            [['YC_PERCENT_ARR'], 'string', 'max' => 4000],
+            [['LEVEL_NAME'], 'unique'],
+            [['ID'], 'unique'],
+        ];
+    }
+
+    /**
+     * @inheritdoc
+     */
+    public function attributeLabels()
+    {
+        return [
+            'ID' => 'ID',
+            'LEVEL_NAME' => '级别名称',
+            'LOCATION_NUM' => '区数量',
+            'LOCATION_PERF' => '单区业绩',
+            'NEW_PERF' => '新增业绩',
+            'MIN_EMPLOY_LEVEL' => '几个区域内分别有几个最低什么聘级的会员',
+            'YC_PERCENT_ARR' => '育成津贴比例集合',
+            'CF_BASE_NUM' => '车房奖基数',
+            'CF_PERCENT' => '车房奖系数',
+            'LX_BASE_NUM' => '领袖奖奖基数',
+            'LX_PERCENT' => '领袖奖系数',
+            'SORT' => '排序',
+            'CREATED_AT' => '创建时间',
+            'UPDATED_AT' => '更新时间',
+            'CREATE_ADMIN' => '创建人',
+            'UPDATE_ADMIN' => '更新人',
+            'ICON_TYPE' => '图标类型',
+            'ICON_NUM' => '图标个数',
+            'RX_PERCENT' => '荣衔奖比例',
+            'OTHER_DEPART_PERF' => '去除最大部门,其它部门累计推荐业绩',
+            'LEVEL_SCORE' => '级别分数',
+            'UPGRADE_SCORE' => '升级分数',
+        ];
+    }
+
+    /**
+     * 获取全部级别以数字索引的方式展现
+     * @return array|\yii\db\ActiveRecord[]
+     */
+    public static function getAllDataWithNumIndex(){
+        $allData = static::find()->where('1=1')->orderBy('SORT ASC, CREATED_AT ASC')->indexBy('SORT')->asArray()->all();
+        foreach($allData as $key=>$data){
+            if($data['YC_PERCENT_ARR']){
+                $allData[$key]['YC_PERCENT_ARR'] = Json::decode($data['YC_PERCENT_ARR']);
+            } else{
+                $allData[$key]['YC_PERCENT_ARR'] = [0,0,0,0,0,0,0,0,0,0];
+            }
+        }
+        return $allData;
+    }
+
+    /**
+     * 获取全部配置,把育成津贴奖金比例解成数组
+     * @return array|\yii\db\ActiveRecord[]
+     */
+    public static function getAllData(){
+        $allData = static::find()->where('1=1')->orderBy('SORT ASC, CREATED_AT ASC')->indexBy('ID')->asArray()->all();
+        foreach($allData as $key=>$data){
+            if($data['YC_PERCENT_ARR']){
+                $allData[$key]['YC_PERCENT_ARR'] = Json::decode($data['YC_PERCENT_ARR']);
+            } else{
+                $allData[$key]['YC_PERCENT_ARR'] = [0,0,0,0,0,0,0,0,0,0];
+            }
+        }
+        return $allData;
+    }
+
+    /**
+     * 从缓存获取信息
+     * @return array|mixed|\yii\db\ActiveRecord[]
+     */
+    public static function getFromCache(){
+        $data = Yii::$app->cache->get(Cache::EMP_LEVEL_CONFIG_KEY);
+        if(!$data){
+            // 获取信息
+            $data = self::getAllData();
+            Yii::$app->cache->set(Cache::EMP_LEVEL_CONFIG_KEY, $data);
+        }
+        return $data;
+    }
+
+    /**
+     *  更新缓存
+     * @return array|\yii\db\ActiveRecord[]
+     */
+    public static function updateToCache(){
+        // 获取配置
+        $data = self::getAllData();
+        Yii::$app->cache->set(Cache::EMP_LEVEL_CONFIG_KEY, $data);
+        return $data;
+    }
+
+    /**
+     * 通过排序获取级别
+     * @param int $sort
+     * @return mixed
+     */
+    public static function getLevelFromSort(int $sort){
+        static $empLevels;
+        if(!$empLevels){
+            $empLevels = self::getFromCache();
+            $empLevels = array_column($empLevels, null, 'sort');
+        }
+        return $empLevels[$sort];
+    }
+
+    /**
+     * 通过排序获取ID
+     * @param int $sort
+     * @return mixed
+     */
+    public static function getIdFromSort(int $sort){
+        $level = self::getLevelFromSort($sort);
+        return $level['ID'];
+    }
+
+    /**
+     * 获取默认级别
+     * @return mixed
+     */
+    public static function getDefaultLevelId(){
+        return self::NO_LEVEL_ID;
+    }
+
+    /**
+     * 获取聘级的排序
+     * @param $id
+     * @return mixed
+     */
+    public static function getSortById($id){
+        $empLevels = self::getFromCache();
+        return $empLevels[$id]['SORT']??0;
+    }
+
+    /**
+     * 是否合格高级经理及以上级别
+     * @param $id
+     * @return bool
+     */
+    public static function chkSenior($id) {
+        if (self::getSortById($id) >= 2) return true;
+        return false;
+    }
+
+    /**
+     * 通过ID获取聘级名称
+     * @param $levelId
+     * @return mixed'
+     */
+    public static function getNameById($levelId){
+        $data = self::findOneAsArray('ID=:ID', [':ID'=>$levelId]);
+        return $data['LEVEL_NAME'];
+    }
+
+    /**
+     * 奖金参数
+     */
+    public static function getBonusConfig(){
+        $allData = self::getAllData();
+        $data = [];
+        foreach ($allData as $value) {
+            $data[$value['ID']]['label'] = $value['LEVEL_NAME'];
+            $data[$value['ID']]['value'] = '【育成津贴】按代数拿奖比例(%)'.implode(",",$value['YC_PERCENT_ARR']).';【车房养老奖】基数'.$value['CF_BASE_NUM'].',分工系数'.$value['CF_PERCENT'].';【领袖分红奖】基数'.$value['LX_BASE_NUM'].',分工系数'.$value['LX_PERCENT'];
+        }
+        return $data;
+    }
+}

+ 0 - 107
common/models/ExcelAddUser.php

@@ -1,107 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%EXCEL_ADD_USER}}".
- *
- * @property string $ID
- * @property string $EXCEL_IMPORT_ID 导入记录表ID
- * @property string $USER_NAME 用户名
- * @property string $DEC_LV 会员级别
- * @property string $REAL_NAME 会员姓名
- * @property string $ID_CARD 身份证
- * @property string $MOBILE 手机
- * @property string $TEL 电话
- * @property string $AREA_PROVINCE 省市
- * @property string $AREA_CITY 市区
- * @property string $AREA_COUNTY 区县
- * @property string $ADDRESS 地址
- * @property string $OPEN_BANK 开户银行
- * @property string $BANK_ADDRESS 开户行地址
- * @property string $BANK_NO 银行账号
- * @property string $BANK_PROVINCE 银行省市
- * @property string $BANK_CITY 银行市区
- * @property string $BANK_COUNTY 银行区县
- * @property string $SUB_COM 子公司
- * @property string $IS_DEC 是否报单中心
- * @property string $DEC_ROLE 报单中心级别
- * @property string $DEC_USER_NAME 所属报单中心编号
- * @property string $BIRTHDAY 生日
- * @property string $CON_USER_NAME 接点人
- * @property string $REC_USER_NAME 开拓人
- * @property string $LOCATION 区位
- * @property int $SORT 审核管理员ID
- * @property int $STATUS 审核管理员ID
- * @property string $ERROR_REMARK 审核管理员ID
- * @property int $CREATED_AT 创建时间
- */
-class ExcelAddUser extends \common\components\ActiveRecord
-{
-    const STATUS_UN = 0; //未导入
-    const STATUS_SUCCESS = 1; // 导入成功
-    const STATUS_FAIL = 2; // 导入失败
-
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%EXCEL_ADD_USER}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['EXCEL_IMPORT_ID', 'SORT', 'CREATED_AT'], 'required'],
-            [['SORT', 'STATUS', 'CREATED_AT'], 'integer'],
-            [['ID', 'EXCEL_IMPORT_ID', 'USER_NAME', 'DEC_LV', 'REAL_NAME', 'ID_CARD', 'MOBILE', 'TEL', 'AREA_PROVINCE', 'AREA_CITY', 'AREA_COUNTY', 'ADDRESS', 'OPEN_BANK', 'BANK_ADDRESS', 'BANK_NO', 'BANK_PROVINCE', 'BANK_CITY', 'BANK_COUNTY', 'SUB_COM', 'IS_DEC', 'DEC_ROLE', 'DEC_USER_NAME', 'BIRTHDAY', 'CON_USER_NAME', 'REC_USER_NAME', 'LOCATION'], 'string', 'max' => 32],
-            [['ERROR_REMARK'], 'string', 'max' => 4000],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'EXCEL_IMPORT_ID' => '导入记录表ID',
-            'USER_NAME' => '用户名',
-            'DEC_LV' => '会员级别',
-            'REAL_NAME' => '会员姓名',
-            'ID_CARD' => '身份证',
-            'MOBILE' => '手机',
-            'TEL' => '电话',
-            'AREA_PROVINCE' => '省市',
-            'AREA_CITY' => '市区',
-            'AREA_COUNTY' => '区县',
-            'ADDRESS' => '地址',
-            'OPEN_BANK' => '开户银行',
-            'BANK_ADDRESS' => '开户行地址',
-            'BANK_NO' => '银行账号',
-            'BANK_PROVINCE' => '银行省市',
-            'BANK_CITY' => '银行市区',
-            'BANK_COUNTY' => '银行区县',
-            'SUB_COM' => '子公司',
-            'IS_DEC' => '是否报单中心',
-            'DEC_ROLE' => '报单中心级别',
-            'DEC_USER_NAME' => '所属报单中心编号',
-            'BIRTHDAY' => '生日',
-            'CON_USER_NAME' => '接点人',
-            'REC_USER_NAME' => '开拓人',
-            'LOCATION' => '区位',
-            'SORT' => '审核管理员ID',
-            'STATUS' => '审核管理员ID',
-            'ERROR_REMARK' => '审核管理员ID',
-            'CREATED_AT' => '创建时间',
-        ];
-    }
-}

+ 0 - 75
common/models/ExcelChangeBalance.php

@@ -1,75 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%EXCEL_CHANGE_BALANCE}}".
- *
- * @property string $ID
- * @property string $EXCEL_IMPORT_ID 导入记录表ID
- * @property string $USER_NAME 会员编号
- * @property string $REAL_NAME 会员姓名
- * @property string $TYPE 账户类型
- * @property string $AMOUNT 调整金额
- * @property string $DEAL_TYPE 交易类型
- * @property string $REMARK 备注
- * @property string $REMARK_IS_SHOW 备注显示
- * @property int $SORT 序号
- * @property int $STATUS 状态
- * @property string $ERROR_REMARK 错误记录
- * @property int $CREATED_AT 创建时间
- */
-class ExcelChangeBalance extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%EXCEL_CHANGE_BALANCE}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['EXCEL_IMPORT_ID', 'USER_NAME', 'REAL_NAME', 'TYPE', 'DEAL_TYPE', 'REMARK_IS_SHOW'], 'required'],
-            [['SORT', 'STATUS', 'CREATED_AT'], 'integer'],
-            [['AMOUNT'], 'number'],
-            [['ID', 'EXCEL_IMPORT_ID', 'REAL_NAME'], 'string', 'max' => 32],
-            [['ERROR_REMARK'], 'string', 'max' => 1000],
-            [['USER_NAME'], 'string', 'max' => 16],
-            [['TYPE'], 'string', 'max' => 20],
-            [['DEAL_TYPE'], 'string', 'max' => 128],
-            [['REMARK'], 'string', 'max' => 2000],
-            [['REMARK_IS_SHOW'], 'string', 'max' => 8],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'EXCEL_IMPORT_ID' => '导入记录表ID',
-            'USER_NAME' => '会员编号',
-            'REAL_NAME' => '会员姓名',
-            'TYPE' => '账户类型',
-            'AMOUNT' => '调整金额',
-            'DEAL_TYPE' => '交易类型',
-            'REMARK' => '备注',
-            'REMARK_IS_SHOW' => '备注显示',
-            'SORT' => '序号',
-            'STATUS' => '状态',
-            'ERROR_REMARK' => '错误记录',
-            'CREATED_AT' => '创建时间',
-        ];
-    }
-}

+ 0 - 61
common/models/ExcelImport.php

@@ -1,61 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%EXCEL_IMPORT}}".
- *
- * @property string $ID
- * @property string $OPTION_NAME 业务名称
- * @property string $TABLE_NAME 对应的待导入数据表名
- * @property string $UPLOAD_ID 上传文件ID
- * @property int $AUDIT_STATUS 审核状态
- * @property string $IMPORT_ADMIN_ID 导入管理员ID
- * @property string $AUDIT_ADMIN_ID 审核管理员ID
- * @property int $CREATED_AT 创建时间
- * @property int $AUDITED_AT 审核时间
- */
-class ExcelImport extends \common\components\ActiveRecord
-{
-
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%EXCEL_IMPORT}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['OPTION_NAME', 'IMPORT_ADMIN_ID', 'CREATED_AT'], 'required'],
-            [['AUDIT_STATUS', 'CREATED_AT', 'AUDITED_AT'], 'integer'],
-            [['ID', 'OPTION_NAME', 'TABLE_NAME', 'UPLOAD_ID', 'IMPORT_ADMIN_ID', 'AUDIT_ADMIN_ID'], 'string', 'max' => 32],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'OPTION_NAME' => '业务名称',
-            'TABLE_NAME' => '对应的待导入数据表名',
-            'UPLOAD_ID' => '上传文件ID',
-            'AUDIT_STATUS' => '审核状态',
-            'IMPORT_ADMIN_ID' => '导入管理员ID',
-            'AUDIT_ADMIN_ID' => '审核管理员ID',
-            'CREATED_AT' => '创建时间',
-            'AUDITED_AT' => '审核时间',
-        ];
-    }
-}

+ 0 - 58
common/models/ExcelOrderShop.php

@@ -1,58 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%EXCEL_ORDER_SHOP}}".
- *
- * @property string $ID
- * @property int $PERIOD_NUM 期数
- * @property int $ORDER_DAY 日期
- * @property int $ORDER_TYPE 订单类型
- * @property int $STATUS 状态
- * @property int $UPDATED_AT 更新时间
- * @property int $CREATED_AT 创建时间
- */
-class ExcelOrderShop extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%EXCEL_ORDER_SHOP}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['ID', 'STATUS'], 'required'],
-            [['PERIOD_NUM', 'STATUS', 'UPDATED_AT', 'CREATED_AT'], 'integer'],
-            [['ID'], 'string', 'max' => 32],
-            //[['PERIOD_NUM'], 'unique'],
-            //[['ORDER_DAY'], 'unique'],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => Yii::t('app', 'ID'),
-            'PERIOD_NUM' => Yii::t('app', 'Period  Num'),
-            'ORDER_DAY' => Yii::t('app', 'Order Day'),
-            'ORDER_TYPE' => Yii::t('app', 'Order Type'),
-            'STATUS' => Yii::t('app', 'Status'),
-            'UPDATED_AT' => Yii::t('app', 'Updated  At'),
-            'CREATED_AT' => Yii::t('app', 'Created  At'),
-        ];
-    }
-}

+ 0 - 90
common/models/ExcelRegInfo.php

@@ -1,90 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%EXCEL_REG_INFO}}".
- *
- * @property string $ID
- * @property string $EXCEL_IMPORT_ID 导入记录表ID
- * @property string $USER_NAME 会员编号
- * @property string $REAL_NAME 会员姓名
- * @property string $ID_CARD 身份证
- * @property string $REG_TYPE 注册类型
- * @property string $REG_NAME 注册名称
- * @property string $CREDIT_CODE 统一社会信用代码
- * @property string $PREMISES 经营场所
- * @property string $REG_EXPIRES 注册有效期
- * @property string $LEGAL_PERSON 法人
- * @property string $OPEN_NAME 企业开户银行
- * @property string $OPEN_BANK 企业开户银行
- * @property string $BANK_ADDRESS 企业开户行地址
- * @property string $BANK_NO 企业银行账号
- * @property string $BANK_PROVINCE 企业银行省市
- * @property string $BANK_CITY 企业银行市区
- * @property string $BANK_COUNTY 企业银行区县
- * @property string $REMARK 备注
- * @property int $SORT 序号
- * @property int $STATUS 状态
- * @property string $ERROR_REMARK 错误备注
- * @property int $CREATED_AT 创建时间
- */
-class ExcelRegInfo extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%EXCEL_REG_INFO}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['EXCEL_IMPORT_ID', 'SORT', 'CREATED_AT'], 'required'],
-            [['SORT', 'STATUS', 'CREATED_AT'], 'integer'],
-            [['ID', 'EXCEL_IMPORT_ID', 'USER_NAME', 'REAL_NAME', 'ID_CARD', 'REG_TYPE', 'BANK_NO', 'BANK_PROVINCE', 'BANK_CITY', 'BANK_COUNTY'], 'string', 'max' => 32],
-            [['REG_NAME', 'CREDIT_CODE', 'PREMISES', 'REG_EXPIRES', 'LEGAL_PERSON', 'OPEN_NAME', 'OPEN_BANK', 'BANK_ADDRESS'], 'string', 'max' => 255],
-            [['REMARK', 'ERROR_REMARK'], 'string', 'max' => 4000],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'EXCEL_IMPORT_ID' => '导入记录表ID',
-            'USER_NAME' => '会员编号',
-            'REAL_NAME' => '会员姓名',
-            'ID_CARD' => '身份证',
-            'REG_TYPE' => '注册类型',
-            'REG_NAME' => '注册名称',
-            'CREDIT_CODE' => '统一社会信用代码',
-            'PREMISES' => '经营场所',
-            'REG_EXPIRES' => '注册有效期',
-            'LEGAL_PERSON' => '法人',
-            'OPEN_NAME' => '企业开户银行',
-            'OPEN_BANK' => '企业开户银行',
-            'BANK_ADDRESS' => '企业开户行地址',
-            'BANK_NO' => '企业银行账号',
-            'BANK_PROVINCE' => '企业银行省市',
-            'BANK_CITY' => '企业银行市区',
-            'BANK_COUNTY' => '企业银行区县',
-            'REMARK' => '备注',
-            'SORT' => '序号',
-            'STATUS' => '状态',
-            'ERROR_REMARK' => '错误备注',
-            'CREATED_AT' => '创建时间',
-        ];
-    }
-}

+ 0 - 73
common/models/ExcelWithdrawPaidFalse.php

@@ -1,73 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%EXCEL_WITHDRAW_PAID_FALSE}}".
- *
- * @property string $ID
- * @property string $EXCEL_IMPORT_ID 导入记录表ID
- * @property string $SN 提现流水号
- * @property int $WITHDRAW_PERIOD_NUM 提现期数
- * @property string $PAID_AT 付款日期
- * @property string $PAID_FAIL_REMARK 付款失败原因
- * @property string $USER_NAME 会员编号
- * @property string $REAL_NAME 会员姓名
- * @property string $AMOUNT 实付金额
- * @property string $BANK_REAL_NAME 实时开户名
- * @property string $BANK_NO 实时银行账户
- * @property int $SORT 序号
- * @property int $STATUS 状态
- * @property string $ERROR_REMARK 错误记录
- * @property int $CREATED_AT 创建时间
- */
-class ExcelWithdrawPaidFalse extends \common\components\ActiveRecord {
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName() {
-        return '{{%EXCEL_WITHDRAW_PAID_FALSE}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules() {
-        return [
-            [['EXCEL_IMPORT_ID', 'SN', 'USER_NAME', 'REAL_NAME', 'BANK_REAL_NAME', 'BANK_NO'], 'required'],
-            [['WITHDRAW_PERIOD_NUM', 'SORT', 'STATUS', 'CREATED_AT'], 'integer'],
-            [['AMOUNT'], 'number'],
-            [['ID', 'EXCEL_IMPORT_ID', 'SN', 'REAL_NAME', 'BANK_NO'], 'string', 'max' => 32],
-            [['PAID_FAIL_REMARK', 'ERROR_REMARK'], 'string', 'max' => 1000],
-            [['USER_NAME'], 'string', 'max' => 16],
-            [['PAID_AT'], 'string', 'max' => 32],
-            [['BANK_REAL_NAME'], 'string', 'max' => 255],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels() {
-        return [
-            'ID' => 'ID',
-            'EXCEL_IMPORT_ID' => '导入记录表ID',
-            'SN' => '提现流水号',
-            'WITHDRAW_PERIOD_NUM' => '提现期数',
-            'PAID_AT' => '付款日期',
-            'PAID_FAIL_REMARK' => '付款失败原因',
-            'USER_NAME' => '会员编号',
-            'REAL_NAME' => '会员姓名',
-            'AMOUNT' => '实付金额',
-            'BANK_REAL_NAME' => '实时开户名',
-            'BANK_NO' => '实时银行账户',
-            'SORT' => '序号',
-            'STATUS' => '状态',
-            'ERROR_REMARK' => '错误记录',
-            'CREATED_AT' => '创建时间',
-        ];
-    }
-}

+ 0 - 77
common/models/Export.php

@@ -1,77 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%EXPORT}}".
- *
- * @property string $ID
- * @property string $EXPORT_NAME 导出名称
- * @property string $MODULE_NAME 模块名称
- * @property string $REMARK 备注
- * @property int $IS_EXPORTING 正在导出
- * @property string $ADMIN_ID 管理员ID
- * @property string $EXPORT_PERCENT 导出进度
- * @property int $STARTED_AT 导出开始时间
- * @property int $ENDED_AT 导出完成时间
- * @property int $CREATED_AT 创建时间
- * @property string $FILE_NAME 文件名称
- * @property string $REMOTE_URL 远程url
- * @property int $FILE_SIZE 文件大小
- * @property string $UPDATER 更新人
- * @property int $UPDATED_AT 更新时间
- */
-class Export extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%EXPORT}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['EXPORT_NAME', 'MODULE_NAME', 'CREATED_AT', 'UPDATED_AT'], 'required'],
-            [['IS_EXPORTING', 'STARTED_AT', 'ENDED_AT', 'CREATED_AT', 'FILE_SIZE', 'UPDATED_AT'], 'integer'],
-            [['EXPORT_PERCENT'], 'number'],
-            [['ID', 'ADMIN_ID'], 'string', 'max' => 32],
-            [['EXPORT_NAME', 'MODULE_NAME', 'REMARK', 'FILE_NAME'], 'string', 'max' => 255],
-            [['REMOTE_URL'], 'string', 'max' => 2000],
-            [['UPDATER'], 'string', 'max' => 16],
-            [['EXPORT_NAME'], 'unique'],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'EXPORT_NAME' => '导出名称',
-            'MODULE_NAME' => '模块名称',
-            'REMARK' => '备注',
-            'IS_EXPORTING' => '正在导出',
-            'ADMIN_ID' => '管理员ID',
-            'EXPORT_PERCENT' => '导出进度',
-            'STARTED_AT' => '导出开始时间',
-            'ENDED_AT' => '导出完成时间',
-            'CREATED_AT' => '创建时间',
-            'FILE_NAME' => '文件名称',
-            'REMOTE_URL' => '远程url',
-            'FILE_SIZE' => '文件大小',
-            'UPDATER' => '更新人',
-            'UPDATED_AT' => '更新时间',
-        ];
-    }
-}

+ 0 - 59
common/models/ExportFile.php

@@ -1,59 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%EXPORT_FILE}}".
- *
- * @property string $ID
- * @property string $FILE_NAME 文件名称
- * @property string $EXPORT_ID 对应导出的ID
- * @property string $URL 文件路径
- * @property string $FILE_SIZE 文件大小
- * @property string $MD5 MD5值
- * @property int $CREATED_AT 创建时间
- */
-class ExportFile extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%EXPORT_FILE}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['FILE_NAME', 'EXPORT_ID', 'CREATED_AT'], 'required'],
-            [['CREATED_AT'], 'integer'],
-            [['ID', 'EXPORT_ID', 'MD5'], 'string', 'max' => 32],
-            [['FILE_NAME', 'FILE_SIZE'], 'string', 'max' => 255],
-            [['URL'], 'string', 'max' => 1000],
-            [['FILE_NAME'], 'unique'],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'FILE_NAME' => '文件名称',
-            'EXPORT_ID' => '对应导出的ID',
-            'URL' => '文件路径',
-            'FILE_SIZE' => '文件大小',
-            'MD5' => 'MD5值',
-            'CREATED_AT' => '创建时间',
-        ];
-    }
-}

+ 0 - 93
common/models/FlowBonus.php

@@ -1,93 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%FLOW_BONUS}}".
- *
- * @property string $ID
- * @property string $USER_ID 会员ID
- * @property string $LAST_DEC_LV 记录时会员级别
- * @property string $LAST_EMP_LV 记录时会员聘级
- * @property int $LAST_STATUS 记录时状态
- * @property string $CALC_ID 奖金结算表ID
- * @property string $AMOUNT 金额
- * @property string $TOTAL 当前总金额
- * @property int $IS_INCR 是否增加
- * @property string $REMARK 备注
- * @property int $REMARK_IS_SHOW 备注是否显示
- * @property string $DEAL_TYPE_ID 交易类型名称
- * @property int $DEAL_TYPE_IS_PRESET 交易类型是否预置
- * @property string $ADMIN_NAME 操作人名称
- * @property int $PERIOD_NUM 所在期数
- * @property int $CALC_MONTH 所在结算月
- * @property string $P_MONTH 表分区的日期索引
- * @property int $CREATED_AT 创建时间
- * @property int $DELETED 是否删除
- * @property int $DELETED_AT 删除时间
- * @property string $TRANSFER_SN 转账流水号
- * @property int $SORT 排序
- */
-class FlowBonus extends \common\components\ActiveRecord
-{
-    const INCR_REDUCE = 0;      // 减少
-    const INCR_ADD = 1;         // 增加
-    const INCR_FREEZE = 2;      // 冻结
-    const INCR_UNFREEZE = 3;    // 解冻
-
-    /**
-     * @inheritdoc
-     */
-    public static function tableName()
-    {
-        return '{{%FLOW_BONUS}}';
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function rules()
-    {
-        return [
-            [['USER_ID', 'REMARK', 'PERIOD_NUM', 'CALC_MONTH', 'P_MONTH', 'CREATED_AT'], 'required'],
-            [['AMOUNT', 'TOTAL'], 'number'],
-            [['LAST_STATUS', 'IS_INCR', 'PERIOD_NUM', 'CALC_MONTH', 'CREATED_AT', 'REMARK_IS_SHOW', 'DELETED', 'DELETED_AT', 'DEAL_TYPE_IS_PRESET', 'SORT'], 'integer'],
-            [['ID', 'USER_ID', 'CALC_ID', 'ADMIN_NAME', 'LAST_DEC_LV', 'LAST_EMP_LV', 'DEAL_TYPE_ID', 'TRANSFER_SN'], 'string', 'max' => 32],
-            [['REMARK'], 'string', 'max' => 255],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_ID' => '会员ID',
-            'LAST_DEC_LV' => '记录时会员级别',
-            'LAST_EMP_LV' => '记录时会员聘级',
-            'LAST_STATUS' => '记录时状态',
-            'CALC_ID' => '奖金结算表ID',
-            'AMOUNT' => '金额',
-            'TOTAL' => '当前总金额',
-            'IS_INCR' => '是否增加',
-            'REMARK' => '备注',
-            'REMARK_IS_SHOW' => '备注是否显示',
-            'DEAL_TYPE_ID' => '交易类型ID',
-            'DEAL_TYPE_IS_PRESET' => '交易类型是否预置',
-            'ADMIN_NAME' => '操作人名称',
-            'PERIOD_NUM' => '所在期数',
-            'CALC_MONTH' => '所在结算月',
-            'P_MONTH' => '表分区的日期索引',
-            'CREATED_AT' => '创建时间',
-            'DELETED' => '是否删除',
-            'DELETED_AT' => '删除时间',
-            'TRANSFER_SN' => '转账流水号',
-            'SORT' => '排序',
-        ];
-    }
-}

+ 0 - 82
common/models/FlowCF.php

@@ -1,82 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%FLOW_CF}}".
- *
- * @property string $ID
- * @property string $USER_ID 会员ID
- * @property string $LAST_DEC_LV 记录时会员级别
- * @property string $LAST_EMP_LV 记录时会员聘级
- * @property int $LAST_STATUS 记录时状态
- * @property string $AMOUNT 金额
- * @property string $TOTAL 当前总金额
- * @property int $IS_INCR 是否增加
- * @property string $REMARK 备注
- * @property int $REMARK_IS_SHOW 备注是否显示
- * @property string $DEAL_TYPE_ID 交易类型名称
- * @property int $DEAL_TYPE_IS_PRESET 交易类型是否预置
- * @property string $ADMIN_NAME 操作人名称
- * @property int $PERIOD_NUM 所在期数
- * @property int $CALC_MONTH 所在结算月
- * @property string $P_MONTH 表分区的日期索引
- * @property int $CREATED_AT 创建时间
- * @property int $DELETED 是否删除
- * @property int $DELETED_AT 删除时间
- */
-class FlowCF extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%FLOW_CF}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['USER_ID', 'REMARK', 'PERIOD_NUM', 'CALC_MONTH', 'P_MONTH', 'CREATED_AT'], 'required'],
-            [['AMOUNT', 'TOTAL'], 'number'],
-            [['LAST_STATUS', 'IS_INCR', 'PERIOD_NUM', 'CALC_MONTH', 'CREATED_AT', 'REMARK_IS_SHOW', 'DELETED', 'DELETED_AT', 'DEAL_TYPE_IS_PRESET'], 'integer'],
-            [['ID', 'USER_ID', 'ADMIN_NAME', 'LAST_DEC_LV', 'LAST_EMP_LV', 'DEAL_TYPE_ID'], 'string', 'max' => 32],
-            [['REMARK'], 'string', 'max' => 255],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_ID' => '会员ID',
-            'LAST_DEC_LV' => '记录时会员级别',
-            'LAST_EMP_LV' => '记录时会员聘级',
-            'LAST_STATUS' => '记录时状态',
-            'AMOUNT' => '金额',
-            'TOTAL' => '当前总金额',
-            'IS_INCR' => '是否增加',
-            'REMARK' => '备注',
-            'REMARK_IS_SHOW' => '备注是否显示',
-            'DEAL_TYPE_ID' => '交易类型ID',
-            'DEAL_TYPE_IS_PRESET' => '交易类型是否预置',
-            'ADMIN_NAME' => '操作人名称',
-            'PERIOD_NUM' => '所在期数',
-            'CALC_MONTH' => '所在结算月',
-            'P_MONTH' => '表分区的日期索引',
-            'CREATED_AT' => '创建时间',
-            'DELETED' => '是否删除',
-            'DELETED_AT' => '删除时间',
-        ];
-    }
-}

+ 0 - 71
common/models/FlowDeductZR.php

@@ -1,71 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%FLOW_DEDUCT_ZR}}".
- *
- * @property string $ID
- * @property string $USER_ID 会员ID
- * @property string $LAST_DEC_LV 记录时会员级别
- * @property string $LAST_EMP_LV 记录时会员聘级
- * @property int $LAST_STATUS 记录时状态
- * @property string $ZR 责任业绩
- * @property string $LOGS 日志
- * @property string $SURPLUS_BONUS 剩余奖金
- * @property int $PERIOD_NUM 结算期数
- * @property int $CALC_YEAR 所在结算年
- * @property int $CALC_MONTH 所在结算月
- * @property string $P_CALC_MONTH 表分区的日期索引
- * @property int $CREATED_AT 创建时间
- */
-class FlowDeductZR extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%FLOW_DEDUCT_ZR}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['USER_ID', 'PERIOD_NUM', 'CALC_YEAR', 'CALC_MONTH', 'P_CALC_MONTH', 'CREATED_AT'], 'required'],
-            [['ZR', 'SURPLUS_BONUS'], 'number'],
-            [['LAST_STATUS', 'PERIOD_NUM', 'CALC_YEAR', 'CALC_MONTH', 'CREATED_AT'], 'integer'],
-            [['ID', 'USER_ID', 'LAST_DEC_LV', 'LAST_EMP_LV'], 'string', 'max' => 32],
-            [['LOGS'], 'string', 'max' => 2000],
-            [['P_CALC_MONTH'], 'safe'],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_ID' => '会员ID',
-            'LAST_DEC_LV' => '记录时会员级别',
-            'LAST_EMP_LV' => '记录时会员聘级',
-            'LAST_STATUS' => '记录时状态',
-            'ZR' => '责任业绩',
-            'LOGS' => '日志',
-            'SURPLUS_BONUS' => '剩余奖金',
-            'PERIOD_NUM' => '结算期数',
-            'CALC_YEAR' => '所在结算年',
-            'CALC_MONTH' => '所在结算月',
-            'P_CALC_MONTH' => '表分区的日期索引',
-            'CREATED_AT' => '创建时间',
-        ];
-    }
-}

+ 0 - 82
common/models/FlowLX.php

@@ -1,82 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%FLOW_LX}}".
- *
- * @property string $ID
- * @property string $USER_ID 会员ID
- * @property string $LAST_DEC_LV 记录时会员级别
- * @property string $LAST_EMP_LV 记录时会员聘级
- * @property int $LAST_STATUS 记录时状态
- * @property string $AMOUNT 金额
- * @property string $TOTAL 当前总金额
- * @property int $IS_INCR 是否增加
- * @property string $REMARK 备注
- * @property int $REMARK_IS_SHOW 备注是否显示
- * @property string $DEAL_TYPE_ID 交易类型名称
- * @property int $DEAL_TYPE_IS_PRESET 交易类型是否预置
- * @property string $ADMIN_NAME 操作人名称
- * @property int $PERIOD_NUM 所在期数
- * @property int $CALC_MONTH 所在结算月
- * @property string $P_MONTH 表分区的日期索引
- * @property int $CREATED_AT 创建时间
- * @property int $DELETED 是否删除
- * @property int $DELETED_AT 删除时间
- */
-class FlowLX extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%FLOW_LX}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['USER_ID', 'REMARK', 'PERIOD_NUM', 'CALC_MONTH', 'P_MONTH', 'CREATED_AT'], 'required'],
-            [['AMOUNT', 'TOTAL'], 'number'],
-            [['LAST_STATUS', 'IS_INCR', 'PERIOD_NUM', 'CALC_MONTH', 'CREATED_AT', 'REMARK_IS_SHOW', 'DELETED', 'DELETED_AT', 'DEAL_TYPE_IS_PRESET'], 'integer'],
-            [['ID', 'USER_ID', 'ADMIN_NAME', 'LAST_DEC_LV', 'LAST_EMP_LV', 'DEAL_TYPE_ID'], 'string', 'max' => 32],
-            [['REMARK'], 'string', 'max' => 255],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_ID' => '会员ID',
-            'LAST_DEC_LV' => '记录时会员级别',
-            'LAST_EMP_LV' => '记录时会员聘级',
-            'LAST_STATUS' => '记录时状态',
-            'AMOUNT' => '金额',
-            'TOTAL' => '当前总金额',
-            'IS_INCR' => '是否增加',
-            'REMARK' => '备注',
-            'REMARK_IS_SHOW' => '备注是否显示',
-            'DEAL_TYPE_ID' => '交易类型ID',
-            'DEAL_TYPE_IS_PRESET' => '交易类型是否预置',
-            'ADMIN_NAME' => '操作人名称',
-            'PERIOD_NUM' => '所在期数',
-            'CALC_MONTH' => '所在结算月',
-            'P_MONTH' => '表分区的日期索引',
-            'CREATED_AT' => '创建时间',
-            'DELETED' => '是否删除',
-            'DELETED_AT' => '删除时间',
-        ];
-    }
-}

+ 0 - 82
common/models/FlowReconsumePoints.php

@@ -1,82 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%FLOW_RECONSUME_POINTS}}".
- *
- * @property string $ID
- * @property string $USER_ID 会员ID
- * @property string $LAST_DEC_LV 记录时会员级别
- * @property string $LAST_EMP_LV 记录时会员聘级
- * @property int $LAST_STATUS 记录时状态
- * @property string $AMOUNT 金额
- * @property string $TOTAL 当前总金额
- * @property int $IS_INCR 是否增加
- * @property string $REMARK 备注
- * @property int $REMARK_IS_SHOW 备注是否显示
- * @property string $DEAL_TYPE_ID 交易类型名称
- * @property int $DEAL_TYPE_IS_PRESET 交易类型是否预置
- * @property string $ADMIN_NAME 操作人名称
- * @property int $PERIOD_NUM 所在期数
- * @property int $CALC_MONTH 所在结算月
- * @property string $P_MONTH 表分区的日期索引
- * @property int $CREATED_AT 创建时间
- * @property int $DELETED 是否删除
- * @property int $DELETED_AT 删除时间
- */
-class FlowReconsumePoints extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%FLOW_RECONSUME_POINTS}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['USER_ID', 'REMARK', 'PERIOD_NUM', 'CALC_MONTH', 'P_MONTH', 'CREATED_AT'], 'required'],
-            [['AMOUNT', 'TOTAL'], 'number'],
-            [['LAST_STATUS', 'IS_INCR', 'PERIOD_NUM', 'CALC_MONTH', 'CREATED_AT', 'REMARK_IS_SHOW', 'DELETED', 'DELETED_AT', 'DEAL_TYPE_IS_PRESET'], 'integer'],
-            [['ID', 'USER_ID', 'ADMIN_NAME', 'LAST_DEC_LV', 'LAST_EMP_LV', 'DEAL_TYPE_ID'], 'string', 'max' => 32],
-            [['REMARK'], 'string', 'max' => 255],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_ID' => '会员ID',
-            'LAST_DEC_LV' => '记录时会员级别',
-            'LAST_EMP_LV' => '记录时会员聘级',
-            'LAST_STATUS' => '记录时状态',
-            'AMOUNT' => '金额',
-            'TOTAL' => '当前总金额',
-            'IS_INCR' => '是否增加',
-            'REMARK' => '备注',
-            'REMARK_IS_SHOW' => '备注是否显示',
-            'DEAL_TYPE_ID' => '交易类型ID',
-            'DEAL_TYPE_IS_PRESET' => '交易类型是否预置',
-            'ADMIN_NAME' => '操作人名称',
-            'PERIOD_NUM' => '所在期数',
-            'CALC_MONTH' => '所在结算月',
-            'P_MONTH' => '表分区的日期索引',
-            'CREATED_AT' => '创建时间',
-            'DELETED' => '是否删除',
-            'DELETED_AT' => '删除时间',
-        ];
-    }
-}

+ 81 - 81
common/models/FlowWallet.php

@@ -1,81 +1,81 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%FLOW_WALLET}}".
- *
- * @property string $ID
- * @property string $USER_ID 会员ID
- * @property string $CALC_ID 奖金结算表ID
- * @property string $AMOUNT 金额
- * @property string $TOTAL 当前总金额
- * @property int $IS_INCR 是否增加
- * @property string $REMARK 备注
- * @property string $ADMIN_NAME 操作人名称
- * @property int $PERIOD_NUM 所在期数
- * @property int $CALC_MONTH 所在结算月
- * @property string $P_MONTH 表分区的日期索引
- * @property int $CREATED_AT 创建时间
- * @property int $DELETED 是否删除
- * @property int $DELETED_AT 删除时间
- * @property int $SORT 排序
- * @property string $TRANSFER_SN 转账流水号
- */
-class FlowWallet extends \common\components\ActiveRecord
-{
-    const INCR_REDUCE = 0;      // 减少
-    const INCR_ADD = 1;         // 增加
-    const INCR_FREEZE = 2;      // 冻结
-    const INCR_UNFREEZE = 3;    // 解冻
-
-    /**
-     * @inheritdoc
-     */
-    public static function tableName()
-    {
-        return '{{%FLOW_WALLET}}';
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function rules()
-    {
-        return [
-            [['USER_ID', 'REMARK', 'PERIOD_NUM', 'CALC_MONTH', 'P_MONTH', 'CREATED_AT'], 'required'],
-            [['AMOUNT', 'TOTAL'], 'number'],
-            [['IS_INCR', 'PERIOD_NUM', 'CALC_MONTH', 'CREATED_AT', 'DELETED', 'DELETED_AT', 'SORT'], 'integer'],
-            [['ID', 'USER_ID', 'CALC_ID', 'ADMIN_NAME', 'TRANSFER_SN'], 'string', 'max' => 32],
-            [['REMARK'], 'string', 'max' => 255],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_ID' => '会员ID',
-            'CALC_ID' => '现金结算表ID',
-            'AMOUNT' => '金额',
-            'TOTAL' => '当前总金额',
-            'IS_INCR' => '是否增加',
-            'REMARK' => '备注',
-            'ADMIN_NAME' => '操作人名称',
-            'PERIOD_NUM' => '所在期数',
-            'CALC_MONTH' => '所在结算月',
-            'P_MONTH' => '表分区的日期索引',
-            'CREATED_AT' => '创建时间',
-            'DELETED' => '是否删除',
-            'DELETED_AT' => '删除时间',
-            'SORT' => '排序',
-            'TRANSFER_SN' => '转账流水号',
-        ];
-    }
-}
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "{{%FLOW_WALLET}}".
+ *
+ * @property string $ID
+ * @property string $USER_ID 会员ID
+ * @property string $CALC_ID 奖金结算表ID
+ * @property string $AMOUNT 金额
+ * @property string $TOTAL 当前总金额
+ * @property int $IS_INCR 是否增加
+ * @property string $REMARK 备注
+ * @property string $ADMIN_NAME 操作人名称
+ * @property int $PERIOD_NUM 所在期数
+ * @property int $CALC_MONTH 所在结算月
+ * @property string $P_MONTH 表分区的日期索引
+ * @property int $CREATED_AT 创建时间
+ * @property int $DELETED 是否删除
+ * @property int $DELETED_AT 删除时间
+ * @property int $SORT 排序
+ * @property string $TRANSFER_SN 转账流水号
+ */
+class FlowWallet extends \common\components\ActiveRecord
+{
+    const INCR_REDUCE = 0;      // 减少
+    const INCR_ADD = 1;         // 增加
+    const INCR_FREEZE = 2;      // 冻结
+    const INCR_UNFREEZE = 3;    // 解冻
+
+    /**
+     * @inheritdoc
+     */
+    public static function tableName()
+    {
+        return '{{%FLOW_WALLET}}';
+    }
+
+    /**
+     * @inheritdoc
+     */
+    public function rules()
+    {
+        return [
+            [['USER_ID', 'REMARK', 'PERIOD_NUM', 'CALC_MONTH', 'P_MONTH', 'CREATED_AT'], 'required'],
+            [['AMOUNT', 'TOTAL'], 'number'],
+            [['IS_INCR', 'PERIOD_NUM', 'CALC_MONTH', 'CREATED_AT', 'DELETED', 'DELETED_AT', 'SORT'], 'integer'],
+            [['ID', 'USER_ID', 'CALC_ID', 'ADMIN_NAME', 'TRANSFER_SN'], 'string', 'max' => 32],
+            [['REMARK'], 'string', 'max' => 255],
+            [['ID'], 'unique'],
+        ];
+    }
+
+    /**
+     * @inheritdoc
+     */
+    public function attributeLabels()
+    {
+        return [
+            'ID' => 'ID',
+            'USER_ID' => '会员ID',
+            'CALC_ID' => '现金结算表ID',
+            'AMOUNT' => '金额',
+            'TOTAL' => '当前总金额',
+            'IS_INCR' => '是否增加',
+            'REMARK' => '备注',
+            'ADMIN_NAME' => '操作人名称',
+            'PERIOD_NUM' => '所在期数',
+            'CALC_MONTH' => '所在结算月',
+            'P_MONTH' => '表分区的日期索引',
+            'CREATED_AT' => '创建时间',
+            'DELETED' => '是否删除',
+            'DELETED_AT' => '删除时间',
+            'SORT' => '排序',
+            'TRANSFER_SN' => '转账流水号',
+        ];
+    }
+}

+ 0 - 111
common/models/HistoryBonus.php

@@ -1,111 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%HISTORY_BONUS}}".
- *
- * @property string $ID
- * @property string $USER_ID 会员ID
- * @property string $USER_NAME 会员编号
- * @property string $REAL_NAME 会员姓名
- * @property string $DEC_LV 会员级别
- * @property string $EMP_LV 聘级
- * @property int $IS_DEC 是否报单中心
- * @property string $DEC_ROLE_ID 报单中心级别
- * @property string $SYSTEM_NAME 体系名称
- * @property string $BONUS 奖金
- * @property string $CF 车房养老余额
- * @property string $LX 领袖分红余额
- * @property string $WITHDRAW 提现金额
- * @property string $WITHDRAW_TAX 个税
- * @property string $WITHDRAW_DEDUCT 扣款
- * @property string $WITHDRAW_REAL 实付金额
- * @property string $WITHDRAW_FAIL 实付失败金额
- * @property int $USER_STATUS 会员状态
- * @property int $USER_STATUS_AT 会员状态变更时间
- * @property string $HIGHEST_EMP_LV 历史最高聘级
- * @property string $PERIOD_AT 加入期数
- * @property string $DEC_DEC_ROLE_ID 所属报单中心级别
- * @property string $DEC_USER_NAME 所属报单中心编号
- * @property string $DEC_REAL_NAME 所属报单中心姓名
- * @property string $MOBILE 手机号
- * @property string $TEL 备用手机号码
- * @property int $PROVINCE 省份
- * @property int $CITY 城市
- * @property int $COUNTY 地区
- * @property string $SUB_COM_ID 所属分公司
- * @property int $IS_DIRECT_SELLER 是否直销员
- * @property int $BACKUP_AT 备份时间
- * @property string $PARTITION_DATE 分区日期
- */
-class HistoryBonus extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%HISTORY_BONUS}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['USER_ID', 'USER_NAME', 'REAL_NAME', 'DEC_LV', 'EMP_LV'], 'required'],
-            [['IS_DEC', 'USER_STATUS', 'USER_STATUS_AT', 'PROVINCE', 'CITY', 'COUNTY', 'IS_DIRECT_SELLER', 'BACKUP_AT'], 'integer'],
-            [['BONUS', 'CF', 'LX', 'WITHDRAW', 'WITHDRAW_TAX', 'WITHDRAW_DEDUCT', 'WITHDRAW_REAL', 'WITHDRAW_FAIL'], 'number'],
-            [['ID', 'USER_ID', 'USER_NAME', 'REAL_NAME', 'DEC_LV', 'EMP_LV', 'DEC_ROLE_ID', 'SYSTEM_NAME', 'HIGHEST_EMP_LV', 'PERIOD_AT', 'DEC_DEC_ROLE_ID', 'DEC_USER_NAME', 'DEC_REAL_NAME', 'SUB_COM_ID'], 'string', 'max' => 32],
-            [['MOBILE', 'TEL'], 'string', 'max' => 11],
-            [['PARTITION_DATE'], 'string', 'max' => 7],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_ID' => '会员ID',
-            'USER_NAME' => '会员编号',
-            'REAL_NAME' => '会员姓名',
-            'DEC_LV' => '会员级别',
-            'EMP_LV' => '聘级',
-            'IS_DEC' => '是否报单中心',
-            'DEC_ROLE_ID' => '报单中心级别',
-            'SYSTEM_NAME' => '体系名称',
-            'BONUS' => '奖金',
-            'CF' => '车房养老余额',
-            'LX' => '领袖分红余额',
-            'WITHDRAW' => '提现金额',
-            'WITHDRAW_TAX' => '个税',
-            'WITHDRAW_DEDUCT' => '扣款',
-            'WITHDRAW_REAL' => '实付金额',
-            'WITHDRAW_FAIL' => '实付失败金额',
-            'USER_STATUS' => '会员状态',
-            'USER_STATUS_AT' => '会员状态变更时间',
-            'HIGHEST_EMP_LV' => '历史最高聘级',
-            'PERIOD_AT' => '加入期数',
-            'DEC_DEC_ROLE_ID' => '所属报单中心级别',
-            'DEC_USER_NAME' => '所属报单中心编号',
-            'DEC_REAL_NAME' => '所属报单中心姓名',
-            'MOBILE' => '手机号',
-            'TEL' => '备用手机号码',
-            'PROVINCE' => '省份',
-            'CITY' => '城市',
-            'COUNTY' => '地区',
-            'SUB_COM_ID' => '所属分公司',
-            'IS_DIRECT_SELLER' => '是否直销员',
-            'BACKUP_AT' => '备份时间',
-            'PARTITION_DATE' => '分区日期',
-        ];
-    }
-}

+ 0 - 66
common/models/ImportScore.php

@@ -1,66 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%IMPORT_SCORE}}".
- *
- * @property string $ID ID
- * @property string $USER_ID 会员ID
- * @property string $USER_NAME 会员编号
- * @property string $REAL_NAME
- * @property string $LEVEL_NAME
- * @property string $EMP_LEVEL_NAME
- * @property string $BONUS_TOTAL
- * @property string $ORI_BONUS_TOTAL
- * @property string $BASE_SCORE 基础分数
- * @property string $LEVEL_SCORE 级别分数
- * @property string $UPGRADE_SCORE 升级分数
- * @property string $TOTAL_SCORE 总分数
- */
-class ImportScore extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%IMPORT_SCORE}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['ID', 'USER_ID', 'USER_NAME', 'REAL_NAME', 'LEVEL_NAME', 'EMP_LEVEL_NAME'], 'required'],
-            [['BONUS_TOTAL', 'ORI_BONUS_TOTAL', 'BASE_SCORE', 'LEVEL_SCORE', 'UPGRADE_SCORE', 'TOTAL_SCORE'], 'number'],
-            [['ID', 'USER_ID', 'USER_NAME', 'REAL_NAME', 'LEVEL_NAME', 'EMP_LEVEL_NAME'], 'string', 'max' => 32],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_ID' => '会员ID',
-            'USER_NAME' => '会员编号',
-            'REAL_NAME' => 'Real  Name',
-            'LEVEL_NAME' => 'Level  Name',
-            'EMP_LEVEL_NAME' => 'Emp  Level  Name',
-            'BONUS_TOTAL' => 'Bonus  Total',
-            'ORI_BONUS_TOTAL' => 'Ori  Bonus  Total',
-            'BASE_SCORE' => '基础分数',
-            'LEVEL_SCORE' => '级别分数',
-            'UPGRADE_SCORE' => '升级分数',
-            'TOTAL_SCORE' => '总分数',
-        ];
-    }
-}

+ 0 - 87
common/models/Invoice.php

@@ -1,87 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%INVOICE}}".
- *
- * @property string $ID
- * @property string $USER_ID 会员ID
- * @property string $REAL_NAME 会员姓名
- * @property string $DEC_LV 报单级别
- * @property string $EMP_LV 聘级
- * @property string $MOBILE 手机号
- * @property string $REG_TYPE 注册类型
- * @property string $REG_NAME 注册名称
- * @property string $CREDIT_CODE 统一代码
- * @property string $SALE_NAME 销售方名称
- * @property string $TAXPAYER_NUMBER 纳税人识别代码
- * @property string $INVOICE_NUMBER 发票号
- * @property string $INVOICE_ACCOUNT 交易账户-发票账户
- * @property string $TAX_ACCOUNT 交易账户-税款账户
- * @property string $AMOUNT 交易金额
- * @property int $OUTED_AT 开票日期
- * @property int $DEDUCT_PERIOD_NUM 发票冲减期数
- * @property string $REMARK 备注
- * @property int $IS_DEL 添加时间
- * @property int $CREATED_AT 是否删除
- * @property int $DELETED_AT 删除时间
- */
-class Invoice extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%INVOICE}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['USER_ID', 'CREATED_AT'], 'required'],
-            [['AMOUNT'], 'number'],
-            [['OUTED_AT', 'DEDUCT_PERIOD_NUM', 'IS_DEL', 'CREATED_AT', 'DELETED_AT'], 'integer'],
-            [['ID', 'USER_ID', 'DEC_LV', 'EMP_LV', 'MOBILE', 'REG_TYPE'], 'string', 'max' => 32],
-            [['REAL_NAME', 'TAXPAYER_NUMBER', 'INVOICE_NUMBER', 'INVOICE_ACCOUNT', 'TAX_ACCOUNT'], 'string', 'max' => 128],
-            [['REG_NAME', 'CREDIT_CODE', 'SALE_NAME', 'REMARK'], 'string', 'max' => 4000],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_ID' => '会员ID',
-            'REAL_NAME' => '会员姓名',
-            'DEC_LV' => '报单级别',
-            'EMP_LV' => '聘级',
-            'MOBILE' => '手机号',
-            'REG_TYPE' => '注册类型',
-            'REG_NAME' => '注册名称',
-            'CREDIT_CODE' => '统一代码',
-            'SALE_NAME' => '销售方名称',
-            'TAXPAYER_NUMBER' => '纳税人识别代码',
-            'INVOICE_NUMBER' => '发票号',
-            'INVOICE_ACCOUNT' => '交易账户-发票账户',
-            'TAX_ACCOUNT' => '交易账户-税款账户',
-            'AMOUNT' => '交易金额',
-            'OUTED_AT' => '开票日期',
-            'DEDUCT_PERIOD_NUM' => '发票冲减期数',
-            'REMARK' => '备注',
-            'IS_DEL' => '添加时间',
-            'CREATED_AT' => '是否删除',
-            'DELETED_AT' => '删除时间',
-        ];
-    }
-}

+ 0 - 98
common/models/InvoiceAudit.php

@@ -1,98 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%INVOICE_AUDIT}}".
- *
- * @property string $ID
- * @property string $USER_ID 会员ID
- * @property string $WITHDRAW_ID 提现ID
- * @property string $INVOICE_CODE 发票代码
- * @property string $INVOICE_NUM 发票号码
- * @property string $INVOICE_DATE 开票日期
- * @property string $AMOUNT 交易金额
- * @property string $TAX_RATE 税率
- * @property string $PURCHASER_NAME 购买方名称
- * @property string $PURCHASER_REGISTER_NUM 购买方纳税人识别号
- * @property string $PURCHASER_ADDRESS 购买方地址电话
- * @property string $PURCHASER_BANK 购买方开户行及帐号
- * @property string $SELLER_NAME 销售方名称
- * @property string $SELLER_REGISTER_NUM 销售方纳税人识别号
- * @property string $SELLER_ADDRESS 销售方地址电话
- * @property string $SELLER_BANK 销售方开户行及帐号
- * @property string $ITEM_NAME 货物或应税劳务、服务名称
- * @property string $INVOICE_REMARK 发票备注
- * @property string $UPLOAD_ID 上传ID
- * @property int $AUDIT_STATUS 审核状态
- * @property string $CREATE_ADMIN 创建管理员
- * @property string $AUDIT_ADMIN 审核管理员
- * @property string $CREATE_REMARK 申请备注
- * @property string $AUDIT_REMARK 审核备注
- * @property int $CREATED_AT 创建时间
- * @property int $AUDITED_AT 审核时间
- */
-class InvoiceAudit extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%INVOICE_AUDIT}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['USER_ID', 'WITHDRAW_ID', 'INVOICE_CODE', 'INVOICE_NUM', 'INVOICE_DATE', 'PURCHASER_NAME', 'PURCHASER_REGISTER_NUM', 'PURCHASER_ADDRESS', 'PURCHASER_BANK', 'SELLER_NAME', 'SELLER_REGISTER_NUM', 'SELLER_ADDRESS', 'SELLER_BANK', 'ITEM_NAME', 'CREATED_AT'], 'required'],
-            [['AMOUNT'], 'number'],
-            [['AUDIT_STATUS', 'CREATED_AT', 'AUDITED_AT'], 'integer'],
-            [['ID', 'USER_ID', 'WITHDRAW_ID', 'CREATE_ADMIN', 'AUDIT_ADMIN'], 'string', 'max' => 32],
-            [['INVOICE_CODE', 'INVOICE_NUM', 'INVOICE_DATE', 'PURCHASER_NAME', 'PURCHASER_REGISTER_NUM', 'PURCHASER_ADDRESS', 'PURCHASER_BANK', 'SELLER_NAME', 'SELLER_REGISTER_NUM', 'SELLER_ADDRESS', 'SELLER_BANK', 'ITEM_NAME', 'INVOICE_REMARK', 'UPLOAD_ID'], 'string', 'max' => 255],
-            [['TAX_RATE'], 'string', 'max' => 10],
-            [['CREATE_REMARK', 'AUDIT_REMARK'], 'string', 'max' => 4000],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_ID' => '会员ID',
-            'WITHDRAW_ID' => '提现ID',
-            'INVOICE_CODE' => '发票代码',
-            'INVOICE_NUM' => '发票号码',
-            'INVOICE_DATE' => '开票日期',
-            'AMOUNT' => '交易金额',
-            'TAX_RATE' => '税率',
-            'PURCHASER_NAME' => '购买方名称',
-            'PURCHASER_REGISTER_NUM' => '购买方纳税人识别号',
-            'PURCHASER_ADDRESS' => '购买方地址电话',
-            'PURCHASER_BANK' => '购买方开户行及帐号',
-            'SELLER_NAME' => '销售方名称',
-            'SELLER_REGISTER_NUM' => '销售方纳税人识别号',
-            'SELLER_ADDRESS' => '销售方地址电话',
-            'SELLER_BANK' => '销售方开户行及帐号',
-            'ITEM_NAME' => '货物或应税劳务、服务名称',
-            'INVOICE_REMARK' => '发票备注',
-            'UPLOAD_ID' => '上传ID',
-            'AUDIT_STATUS' => '审核状态',
-            'CREATE_ADMIN' => '创建管理员',
-            'AUDIT_ADMIN' => '审核管理员',
-            'CREATE_REMARK' => '申请备注',
-            'AUDIT_REMARK' => '审核备注',
-            'CREATED_AT' => '创建时间',
-            'AUDITED_AT' => '审核时间',
-        ];
-    }
-}

+ 0 - 64
common/models/InvoiceBalanceAudit.php

@@ -1,64 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%INVOICE_BALANCE_AUDIT}}".
- *
- * @property string $ID
- * @property string $USER_ID 会员ID
- * @property string $AMOUNT 调整金额
- * @property int $AUDIT_STATUS 审核状态
- * @property string $CREATE_ADMIN 创建管理员
- * @property string $AUDIT_ADMIN 审核管理员
- * @property string $CREATE_REMARK 申请备注
- * @property string $AUDIT_REMARK 审核备注
- * @property int $CREATED_AT 创建时间
- * @property int $AUDITED_AT 审核时间
- */
-class InvoiceBalanceAudit extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%INVOICE_BALANCE_AUDIT}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['USER_ID', 'CREATE_ADMIN', 'CREATED_AT'], 'required'],
-            [['AMOUNT'], 'number'],
-            [['AUDIT_STATUS', 'CREATED_AT', 'AUDITED_AT'], 'integer'],
-            [['ID', 'USER_ID', 'CREATE_ADMIN', 'AUDIT_ADMIN'], 'string', 'max' => 32],
-            [['CREATE_REMARK', 'AUDIT_REMARK'], 'string', 'max' => 4000],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_ID' => '会员ID',
-            'AMOUNT' => '调整金额',
-            'AUDIT_STATUS' => '审核状态',
-            'CREATE_ADMIN' => '创建管理员',
-            'AUDIT_ADMIN' => '审核管理员',
-            'CREATE_REMARK' => '申请备注',
-            'AUDIT_REMARK' => '审核备注',
-            'CREATED_AT' => '创建时间',
-            'AUDITED_AT' => '审核时间',
-        ];
-    }
-}

+ 0 - 109
common/models/InvoiceFlow.php

@@ -1,109 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%INVOICE_FLOW}}".
- *
- * @property string $ID
- * @property string $USER_ID 会员ID
- * @property string $REAL_NAME 会员姓名
- * @property string $DEC_LV 报单级别
- * @property string $EMP_LV 聘级
- * @property string $MOBILE 手机号
- * @property string $REG_TYPE 注册类型
- * @property string $REG_NAME 注册名称
- * @property string $CREDIT_CODE 统一社会信用代码
- * @property string $SALE_NAME 销售方名称
- * @property string $TAXPAYER_NUMBER 纳税人识别号
- * @property string $INVOICE_ACCOUNT 交易账户-发票账户
- * @property string $INVOICE_SN 发票号
- * @property string $TAX_ACCOUNT 交易账户-税款账户
- * @property int $OUTED_AT 开票日期
- * @property int $DEDUCT_PERIOD_NUM 发票冲减期数
- * @property string $AMOUNT 金额
- * @property string $TOTAL 当前总金额
- * @property string $WITHDRAW_SN 提现流水号
- * @property int $IS_INCR 是否增加
- * @property string $REMARK 备注
- * @property int $PERIOD_NUM 所在期数
- * @property int $CALC_MONTH 所在结算月
- * @property string $CREATE_ADMIN 创建人
- * @property string $CREATE_REMARK 创建备注
- * @property int $CREATE_TIME 创建时间
- * @property string $AUDIT_ADMIN 审核人
- * @property string $AUDIT_REMARK 审核备注
- * @property int $AUDIT_TIME 审核时间
- * @property string $P_MONTH 表分区的日期索引
- * @property int $CREATED_AT 创建时间
- */
-class InvoiceFlow extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%INVOICE_FLOW}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['USER_ID', 'REAL_NAME', 'DEC_LV', 'EMP_LV', 'MOBILE', 'REG_TYPE', 'REG_NAME', 'CREDIT_CODE', 'REMARK', 'PERIOD_NUM', 'CALC_MONTH', 'CREATE_ADMIN', 'CREATE_TIME', 'AUDIT_ADMIN', 'AUDIT_TIME', 'P_MONTH', 'CREATED_AT'], 'required'],
-            [['OUTED_AT', 'DEDUCT_PERIOD_NUM', 'IS_INCR', 'PERIOD_NUM', 'CALC_MONTH', 'CREATE_TIME', 'AUDIT_TIME', 'CREATED_AT'], 'integer'],
-            [['AMOUNT', 'TOTAL'], 'number'],
-            [['ID', 'USER_ID', 'DEC_LV', 'EMP_LV', 'MOBILE', 'REG_TYPE', 'CREATE_ADMIN', 'AUDIT_ADMIN'], 'string', 'max' => 32],
-            [['REAL_NAME'], 'string', 'max' => 128],
-            [['REG_NAME', 'CREDIT_CODE', 'SALE_NAME', 'TAXPAYER_NUMBER', 'INVOICE_ACCOUNT', 'INVOICE_SN', 'TAX_ACCOUNT', 'WITHDRAW_SN', 'REMARK'], 'string', 'max' => 255],
-            [['CREATE_REMARK', 'AUDIT_REMARK'], 'string', 'max' => 4000],
-            [['P_MONTH'], 'string', 'max' => 7],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_ID' => '会员ID',
-            'REAL_NAME' => '会员姓名',
-            'DEC_LV' => '报单级别',
-            'EMP_LV' => '聘级',
-            'MOBILE' => '手机号',
-            'REG_TYPE' => '注册类型',
-            'REG_NAME' => '注册名称',
-            'CREDIT_CODE' => '统一社会信用代码',
-            'SALE_NAME' => '销售方名称',
-            'TAXPAYER_NUMBER' => '纳税人识别号',
-            'INVOICE_ACCOUNT' => '交易账户-发票账户',
-            'INVOICE_SN' => '发票号',
-            'TAX_ACCOUNT' => '交易账户-税款账户',
-            'OUTED_AT' => '开票日期',
-            'DEDUCT_PERIOD_NUM' => '发票冲减期数',
-            'AMOUNT' => '金额',
-            'TOTAL' => '当前总金额',
-            'WITHDRAW_SN' => '提现流水号',
-            'IS_INCR' => '是否增加',
-            'REMARK' => '备注',
-            'PERIOD_NUM' => '所在期数',
-            'CALC_MONTH' => '所在结算月',
-            'CREATE_ADMIN' => '创建人',
-            'CREATE_REMARK' => '创建备注',
-            'CREATE_TIME' => '创建时间',
-            'AUDIT_ADMIN' => '审核人',
-            'AUDIT_REMARK' => '审核备注',
-            'AUDIT_TIME' => '审核时间',
-            'P_MONTH' => '表分区的日期索引',
-            'CREATED_AT' => '创建时间',
-        ];
-    }
-}

+ 0 - 121
common/models/LogAdminHandle.php

@@ -1,121 +0,0 @@
-<?php
-
-namespace common\models;
-
-use common\components\MongoActiveRecord;
-use Yii;
-
-/**
- * This is the model class for collection "ar_bonus_admin_log".
- *
- * @property \MongoDB\BSON\ObjectID|string $_id
- * @property mixed $admin_id
- * @property mixed $admin_name
- * @property mixed $ip
- * @property mixed $created_at
- * @property mixed $request_route
- * @property mixed $opt_type
- * @property mixed $save_before_content
- * @property mixed $save_after_content
- * @property mixed $key_log
- * @property mixed $opt_obj_id
- * @property mixed $opt_obj_name
- * @property mixed $remark
- * @property mixed $user_agent
- * @property mixed $period_num
- * @property mixed $is_batch
- * @property mixed $device
- */
-class LogAdminHandle extends MongoActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function collectionName()
-    {
-        return 'ar_bonus_admin_log';
-    }
-
-    /**
-     * @return \yii\mongodb\Connection the MongoDB connection used by this AR class.
-     */
-    public static function getDb()
-    {
-        return Yii::$app->get('dbLog');
-    }
-
-    /**
-     * 获取id
-     * @return string
-     */
-    public function getId() {
-        return (string) $this->_id;
-    }
-    /**
-     * {@inheritdoc}
-     */
-    public function attributes()
-    {
-        return [
-            '_id',
-            'admin_id',
-            'admin_name',
-            'ip',
-            'created_at',
-            'request_route',
-            'opt_type',
-            'save_before_content',
-            'save_after_content',
-            'key_log',
-            'opt_obj_id',
-            'opt_obj_name',
-            'remark',
-            'user_agent',
-            'period_num',
-            'is_batch',
-            'device',
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['admin_id', 'admin_name', 'ip', 'request_route', 'opt_type'], 'required'],
-            [['created_at', 'key_log', 'period_num', 'is_batch'], 'integer'],
-            [['admin_id', 'opt_obj_id'], 'string', 'max' => 32],
-            [['admin_name', 'ip', 'opt_obj_name'], 'string', 'max' => 16],
-            [['_id', 'opt_type', 'save_before_content', 'save_after_content', 'device'], 'safe'],
-            [['user_agent', 'request_route', 'remark'], 'string', 'max' => 1000],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            '_id' => 'ID',
-            'admin_id' => '操作人id',
-            'admin_name' => '操作人',
-            'ip' => '操作ip',
-            'created_at' => '创建时间',
-            'request_route' => '请求路由',
-            'opt_type' => '操作类型',
-            'save_before_content' => '保存前的内容',
-            'save_after_content' => '保存后的内容',
-            'key_log' => '关键日志',
-            'opt_obj_id' => '操作对象id',
-            'opt_obj_name' => '操作对象名称',
-            'remark' => '备注',
-            'user_agent' => '浏览器特征',
-            'period_num' => '期数',
-            'is_batch' => '批量保存',
-            'device' => '客户端',
-        ];
-    }
-
-}

+ 0 - 105
common/models/LogAdminLogin.php

@@ -1,105 +0,0 @@
-<?php
-
-namespace common\models;
-
-use common\components\MongoActiveRecord;
-use Yii;
-
-/**
- * This is the model class for collection "ar_bonus_admin_login".
- *
- * @property \MongoDB\BSON\ObjectID|string $_id
- * @property mixed $adm_name
- * @property mixed $opt_type
- * @property mixed $return_result
- * @property mixed $success_times
- * @property mixed $fail_times
- * @property mixed $device
- * @property mixed $request_route
- * @property mixed $ip
- * @property mixed $created_at
- * @property mixed $user_agent
- * @property mixed $period_num
- */
-class LogAdminLogin extends MongoActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function collectionName()
-    {
-        return 'ar_bonus_admin_login';
-    }
-
-    /**
-     * @return \yii\mongodb\Connection the MongoDB connection used by this AR class.
-     */
-    public static function getDb()
-    {
-        return Yii::$app->get('dbLog');
-    }
-
-    /**
-     * 获取id
-     * @return string
-     */
-    public function getId() {
-        return (string) $this->_id;
-    }
-    /**
-     * {@inheritdoc}
-     */
-    public function attributes()
-    {
-        return [
-            '_id',
-            'adm_name',
-            'ip',
-            'created_at',
-            'user_agent',
-            'period_num',
-            'opt_type',
-            'success_times',
-            'fail_times',
-            'device',
-            'request_route',
-            'return_result',
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['adm_name', 'ip', 'request_route'], 'required'],
-            [['created_at', 'success_times', 'period_num', 'fail_times'], 'integer'],
-            [['adm_name', 'ip',  'opt_type'], 'string', 'max' => 16],
-            [['_id', 'return_result', 'device',], 'safe'],
-            [['user_agent', 'request_route'], 'string', 'max' => 1000],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            '_id' => 'ID',
-            'adm_name' => '对象编号',
-            'ip' => '操作ip',
-            'created_at' => '创建时间',
-            'user_agent' => '浏览器特征',
-            'period_num' => '期数',
-            'opt_type' => '操作类型',
-            'success_times' => '登陆成功次数',
-            'fail_times' => '登录失败次数',
-            'device' => '客户端',
-            'request_route' => '请求路径',
-            'return_result' => '返回内容',
-        ];
-    }
-
-}

+ 0 - 131
common/models/OrderDec.php

@@ -1,131 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%ORDER_DEC}}".
- *
- * @property string $ID
- * @property string $SN 订单号
- * @property string $DEC_SN 报单编号
- * @property string $USER_ID 用户ID
- * @property string $USER_NAME 会员编号
- * @property string $ORDER_TYPE 订货类型
- * @property string $ORDER_AMOUNT 订单总价格
- * @property string $PV 订货PV
- * @property string $PAY_AMOUNT 支付价格
- * @property string $PAY_PV 实付PV
- * @property int $PAY_AT 支付时间
- * @property string $PAY_TYPE 支付方式
- * @property string $FREIGHT 运费
- * @property string $PAY_FREIGHT 实付运费金额
- * @property int $DELIVERY_STATUS 发货状态
- * @property int $DELIVERY_PERIOD 发货期数
- * @property int $DELIVERY_AT 发货时间
- * @property string $EXPRESS_COMPANY 快递公司
- * @property string $ORDER_TRACK_NO 快递单号
- * @property int $EXPRESS_TYPE 发货方式
- * @property string $FRONT_REMARK 前台备注
- * @property string $REMARK 后台备注
- * @property int $PERIOD_NUM 期数
- * @property int $ORDER_DAY 日期
- * @property int $STATUS 订单状态
- * @property string $CONSIGNEE 收货人
- * @property string $MOBILE 收货人手机
- * @property string $TEL 固定电话
- * @property string $PROVINCE 省份名称
- * @property string $CITY 城市名称
- * @property string $COUNTY 县区
- * @property string $ADDRESS 详细地址
- * @property string $P_CALC_MONTH 分区日期
- * @property int $CREATED_AT 订单创建时间
- * @property string $CREATE_USER 订单创建人
- * @property int $UPDATED_AT 修改时间
- * @property string $UPDATER 修改人
- * @property int $IS_DELETE 是否删除
- * @property int $DELETED_AT 删除时间
- * @property int $WAREHOUSE 发货仓
- */
-class OrderDec extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%ORDER_DEC}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['USER_ID', 'USER_NAME', 'ORDER_TYPE', 'CREATE_USER'], 'required'],
-            [['ORDER_AMOUNT', 'PV', 'PAY_AMOUNT', 'PAY_PV', 'FREIGHT', 'PAY_FREIGHT'], 'number'],
-            [['PAY_AT', 'DELIVERY_STATUS', 'DELIVERY_PERIOD', 'DELIVERY_AT', 'EXPRESS_TYPE', 'PERIOD_NUM', 'STATUS', 'CREATED_AT', 'UPDATED_AT', 'IS_DELETE', 'DELETED_AT'], 'integer'],
-            [['ID','SN', 'DEC_SN', 'USER_ID', 'ORDER_TRACK_NO','PAY_TYPE', 'PROVINCE', 'CITY', 'COUNTY'], 'string', 'max' => 32],
-            [['USER_NAME', 'TEL', 'CREATE_USER', 'UPDATER', 'WAREHOUSE', 'ORDER_DAY'], 'string', 'max' => 16],
-            [['ORDER_TYPE'], 'string', 'max' => 12],
-            [['EXPRESS_COMPANY'], 'string', 'max' => 128],
-            [['FRONT_REMARK'], 'string', 'max' => 1000],
-            [['REMARK'], 'string', 'max' => 4000],
-            [['CONSIGNEE'], 'string', 'max' => 120],
-            [['MOBILE'], 'string', 'max' => 11],
-            [['ADDRESS'], 'string', 'max' => 255],
-            [['SN'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'SN' => '订单号',
-            'DEC_SN' => '报单编号',
-            'USER_ID' => '用户ID',
-            'USER_NAME' => '会员编号',
-            'ORDER_TYPE' => '订货类型',
-            'ORDER_AMOUNT' => '订单总价格',
-            'PV' => '订货PV',
-            'PAY_AMOUNT' => '支付价格',
-            'PAY_PV' => '实付PV',
-            'PAY_AT' => '支付时间',
-            'PAY_TYPE' => '支付方式',
-            'FREIGHT' => '运费',
-            'PAY_FREIGHT' => '实付运费金额',
-            'DELIVERY_STATUS' => '发货状态',
-            'DELIVERY_PERIOD' => '发货期数',
-            'DELIVERY_AT' => '发货时间',
-            'EXPRESS_COMPANY' => '快递公司',
-            'ORDER_TRACK_NO' => '快递单号',
-            'EXPRESS_TYPE' => '发货方式',
-            'FRONT_REMARK' => '前台备注',
-            'REMARK' => '后台备注',
-            'PERIOD_NUM' => '期数',
-            'ORDER_DAY' => '日期',
-            'STATUS' => '订单状态',
-            'CONSIGNEE' => '收货人',
-            'MOBILE' => '收货人手机',
-            'TEL' => '固定电话',
-            'PROVINCE' => '省份名称',
-            'CITY' => '城市名称',
-            'COUNTY' => '县区',
-            'ADDRESS' => '详细地址',
-            'P_CALC_MONTH' => '分区日期',
-            'CREATED_AT' => '订单创建时间',
-            'CREATE_USER' => '订单创建人',
-            'UPDATED_AT' => '修改时间',
-            'UPDATER' => '修改人',
-            'IS_DELETE' => '是否删除',
-            'DELETED_AT' => '删除时间',
-            'WAREHOUSE' => '发货仓',
-        ];
-    }
-}

+ 0 - 71
common/models/OrderGoodsDec.php

@@ -1,71 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%ORDER_GOODS_DEC}}".
- *
- * @property string $ID
- * @property string $ORDER_SN 订单ID
- * @property string $GOODS_TITLE 商品名称
- * @property string $PRICE 价格
- * @property string $REAL_PRICE 实际价格
- * @property string $PV 订货PV
- * @property string $REAL_PV 实际PV
- * @property string $POINT 兑换积分
- * @property int $PERIOD_NUM 期数
- * @property int $ORDER_DAY 日期
- * @property string $SKU_CODE 商品编码
- * @property int $BUY_NUMS 购买数量
- * @property string $P_CALC_MONTH 分区日期
- */
-class OrderGoodsDec extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%ORDER_GOODS_DEC}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['ORDER_SN', 'GOODS_TITLE', 'SKU_CODE'], 'required'],
-            [['PRICE', 'REAL_PRICE', 'PV', 'REAL_PV', 'POINT'], 'number'],
-            [['BUY_NUMS', 'PERIOD_NUM'], 'integer'],
-            [['ID', 'ORDER_SN'], 'string', 'max' => 32],
-            [['GOODS_TITLE'], 'string', 'max' => 255],
-            [['SKU_CODE','ORDER_DAY'], 'string', 'max' => 16],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'ORDER_SN' => '订单ID',
-            'GOODS_TITLE' => '商品名称',
-            'PRICE' => '价格',
-            'REAL_PRICE' => '实际价格',
-            'PV' => '订货PV',
-            'REAL_PV' => '实际PV',
-            'POINT' => '兑换积分',
-            'PERIOD_NUM' => '期数',
-            'ORDER_DAY' => '日期',
-            'SKU_CODE' => '商品编码',
-            'BUY_NUMS' => '购买数量',
-            'P_CALC_MONTH' => '分区日期',
-        ];
-    }
-}

+ 0 - 129
common/models/OrderStandard.php

@@ -1,129 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%ORDER_STANDARD}}".
- *
- * @property string $ID
- * @property string $SN
- * @property string $DEC_SN
- * @property string $USER_ID
- * @property string $USER_NAME
- * @property string $ORDER_TYPE
- * @property string $ORDER_AMOUNT
- * @property string $PV
- * @property string $PAY_AMOUNT
- * @property string $PAY_PV
- * @property int $PAY_AT
- * @property double $FREIGHT
- * @property double $PAY_FREIGHT
- * @property int $DELIVERY_STATUS
- * @property int $DELIVERY_PERIOD
- * @property int $DELIVERY_AT
- * @property string $EXPRESS_COMPANY
- * @property string $ORDER_TRACK_NO
- * @property int $EXPRESS_TYPE
- * @property string $FRONT_REMARK
- * @property string $REMARK
- * @property int $PERIOD_NUM
- * @property int $CALC_MONTH 结算月
- * @property int $STATUS
- * @property string $CONSIGNEE
- * @property string $MOBILE
- * @property string $TEL
- * @property string $PROVINCE
- * @property string $CITY
- * @property string $COUNTY
- * @property string $ADDRESS
- * @property int $CREATED_AT
- * @property string $CREATE_USER
- * @property int $UPDATED_AT
- * @property string $UPDATER
- * @property int $IS_DELETE
- * @property int $DELETED_AT
- * @property string $PAY_TYPE
- * @property string $WAREHOUSE
- */
-class OrderStandard extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%ORDER_STANDARD}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['ID', 'USER_ID', 'USER_NAME', 'ORDER_TYPE', 'CALC_MONTH', 'CREATE_USER'], 'required'],
-            [['ORDER_AMOUNT', 'PV', 'PAY_AMOUNT', 'PAY_PV', 'FREIGHT', 'PAY_FREIGHT'], 'number'],
-            [['PAY_AT', 'DELIVERY_STATUS', 'DELIVERY_PERIOD', 'DELIVERY_AT', 'EXPRESS_TYPE', 'PERIOD_NUM', 'CALC_MONTH', 'STATUS', 'CREATED_AT', 'UPDATED_AT', 'IS_DELETE', 'DELETED_AT'], 'integer'],
-            [['REMARK'], 'string'],
-            [['ID', 'SN', 'DEC_SN', 'USER_ID', 'ORDER_TRACK_NO', 'PROVINCE', 'CITY', 'COUNTY', 'PAY_TYPE'], 'string', 'max' => 32],
-            [['USER_NAME', 'TEL', 'CREATE_USER', 'UPDATER', 'WAREHOUSE'], 'string', 'max' => 16],
-            [['ORDER_TYPE'], 'string', 'max' => 12],
-            [['EXPRESS_COMPANY'], 'string', 'max' => 128],
-            [['FRONT_REMARK'], 'string', 'max' => 1000],
-            [['CONSIGNEE'], 'string', 'max' => 120],
-            [['MOBILE'], 'string', 'max' => 11],
-            [['ADDRESS'], 'string', 'max' => 255],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'SN' => 'Sn',
-            'DEC_SN' => 'Dec  Sn',
-            'USER_ID' => 'User  ID',
-            'USER_NAME' => 'User  Name',
-            'ORDER_TYPE' => 'Order  Type',
-            'ORDER_AMOUNT' => 'Order  Amount',
-            'PV' => 'Pv',
-            'PAY_AMOUNT' => 'Pay  Amount',
-            'PAY_PV' => 'Pay  Pv',
-            'PAY_AT' => 'Pay  At',
-            'FREIGHT' => 'Freight',
-            'PAY_FREIGHT' => 'Pay  Freight',
-            'DELIVERY_STATUS' => 'Delivery  Status',
-            'DELIVERY_PERIOD' => 'Delivery  Period',
-            'DELIVERY_AT' => 'Delivery  At',
-            'EXPRESS_COMPANY' => 'Express  Company',
-            'ORDER_TRACK_NO' => 'Order  Track  No',
-            'EXPRESS_TYPE' => 'Express  Type',
-            'FRONT_REMARK' => 'Front  Remark',
-            'REMARK' => 'Remark',
-            'PERIOD_NUM' => 'Period  Num',
-            'CALC_MONTH' => '结算月',
-            'STATUS' => 'Status',
-            'CONSIGNEE' => 'Consignee',
-            'MOBILE' => 'Mobile',
-            'TEL' => 'Tel',
-            'PROVINCE' => 'Province',
-            'CITY' => 'City',
-            'COUNTY' => 'County',
-            'ADDRESS' => 'Address',
-            'CREATED_AT' => 'Created  At',
-            'CREATE_USER' => 'Create  User',
-            'UPDATED_AT' => 'Updated  At',
-            'UPDATER' => 'Updater',
-            'IS_DELETE' => 'Is  Delete',
-            'DELETED_AT' => 'Deleted  At',
-            'PAY_TYPE' => 'Pay  Type',
-            'WAREHOUSE' => 'Warehouse',
-        ];
-    }
-}

+ 0 - 71
common/models/OrderStandardGoods.php

@@ -1,71 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%ORDER_STANDARD_GOODS}}".
- *
- * @property string $ID
- * @property string $ORDER_SN
- * @property string $GOODS_TITLE
- * @property string $PRICE
- * @property string $REAL_PRICE
- * @property string $PV
- * @property string $REAL_PV
- * @property string $SKU_CODE
- * @property int $BUY_NUMS
- * @property int $POINT
- * @property int $PERIOD_NUM
- * @property int $CALC_MONTH 结算月
- * @property string $PAY_TYPE
- */
-class OrderStandardGoods extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%ORDER_STANDARD_GOODS}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['ID', 'ORDER_SN', 'GOODS_TITLE', 'SKU_CODE', 'CALC_MONTH'], 'required'],
-            [['PRICE', 'REAL_PRICE', 'PV', 'REAL_PV'], 'number'],
-            [['BUY_NUMS', 'POINT', 'PERIOD_NUM', 'CALC_MONTH'], 'integer'],
-            [['ID', 'ORDER_SN', 'PAY_TYPE'], 'string', 'max' => 32],
-            [['GOODS_TITLE'], 'string', 'max' => 255],
-            [['SKU_CODE'], 'string', 'max' => 16],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'ORDER_SN' => 'Order  Sn',
-            'GOODS_TITLE' => 'Goods  Title',
-            'PRICE' => 'Price',
-            'REAL_PRICE' => 'Real  Price',
-            'PV' => 'Pv',
-            'REAL_PV' => 'Real  Pv',
-            'SKU_CODE' => 'Sku  Code',
-            'BUY_NUMS' => 'Buy  Nums',
-            'POINT' => 'Point',
-            'PERIOD_NUM' => 'Period  Num',
-            'CALC_MONTH' => '结算月',
-            'PAY_TYPE' => 'Pay  Type',
-        ];
-    }
-}

+ 0 - 205
common/models/PerfAudit.php

@@ -1,205 +0,0 @@
-<?php
-
-namespace common\models;
-
-use backendApi\modules\v1\models\Admin;
-use common\helpers\user\Info;
-use common\libs\logging\operate\valueType\Config as ValueTypeConfig;
-use Yii;
-
-/**
- * This is the model class for table "{{%PERF_AUDIT}}".
- *
- * @property string $ID
- * @property string $USER_ID 会员ID
- * @property string $PV_1L 一市场累计
- * @property string $PV_2L 二市场累计
- * @property string $PV_3L 三市场累计
- * @property string $PV_4L 四市场累计
- * @property string $PV_5L 五市场累计
- * @property string $SURPLUS_1L 一市场结余
- * @property string $SURPLUS_2L 二市场结余
- * @property string $SURPLUS_3L 三市场结余
- * @property string $SURPLUS_4L 四市场结余
- * @property string $SURPLUS_5L 五市场结余
- * @property string $SURPLUS_LS 零售结余
- * @property int $PERF_TYPE 业绩类型
- * @property int $PERF_LOCATION 业绩区域
- * @property string $AMOUNT 调整金额
- * @property string $PERF_BEFORE 业绩调整前
- * @property string $PERF_AFTER 业绩调整后
- * @property int $PERIOD_NUM 调整期数
- * @property int $AUDIT_STATUS 审核状态
- * @property string $CREATE_ADMIN 创建管理员
- * @property string $REMARK 备注
- * @property string $AUDIT_ADMIN 审核管理员
- * @property int $CREATED_AT 创建时间
- * @property int $AUDITED_AT 审核时间
- */
-class PerfAudit extends \common\components\ActiveRecord
-{
-    const PERF_TYPE_PV=1;
-    const PERF_TYPE_SURPLUS=2;
-    const CHANGE_PERF_TYPE = [
-        self::PERF_TYPE_PV => '总网业绩',
-        self::PERF_TYPE_SURPLUS => '大区剩余'
-    ];
-    const PERF_LOCATION_NAME = [
-        1=>'一市场',
-        2=>'二市场',
-        3=>'三市场',
-        4=>'四市场',
-        5=>'五市场',
-        6=>'虚拟零售区',
-    ];
-
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%PERF_AUDIT}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['USER_ID', 'CREATED_AT'], 'required'],
-            [['PV_1L', 'PV_2L', 'PV_3L', 'PV_4L', 'PV_5L', 'SURPLUS_1L', 'SURPLUS_2L', 'SURPLUS_3L', 'SURPLUS_4L', 'SURPLUS_5L', 'SURPLUS_LS', 'PERF_BEFORE', 'PERF_AFTER', 'AMOUNT'], 'number'],
-            [['PERF_TYPE', 'PERF_LOCATION', 'PERIOD_NUM', 'AUDIT_STATUS', 'CREATED_AT', 'AUDITED_AT'], 'integer'],
-            [['ID', 'USER_ID', 'CREATE_ADMIN', 'AUDIT_ADMIN'], 'string', 'max' => 32],
-            [['REMARK'], 'string', 'max' => 4000],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_ID' => '会员ID',
-            'PV_1L' => '一市场累计',
-            'PV_2L' => '二市场累计',
-            'PV_3L' => '三市场累计',
-            'PV_4L' => '四市场累计',
-            'PV_5L' => '五市场累计',
-            'SURPLUS_1L' => '一市场结余',
-            'SURPLUS_2L' => '二市场结余',
-            'SURPLUS_3L' => '三市场结余',
-            'SURPLUS_4L' => '四市场结余',
-            'SURPLUS_5L' => '五市场结余',
-            'SURPLUS_LS' => '零售结余',
-            'PERF_TYPE' => '业绩类型',
-            'PERF_LOCATION' => '业绩区域',
-            'AMOUNT' => '调整金额',
-            'PERF_BEFORE' => '业绩调整前',
-            'PERF_AFTER' => '业绩调整后',
-            'PERIOD_NUM' => '调整期数',
-            'AUDIT_STATUS' => '审核状态',
-            'CREATE_ADMIN' => '创建管理员',
-            'REMARK' => '备注',
-            'AUDIT_ADMIN' => '审核管理员',
-            'CREATED_AT' => '创建时间',
-            'AUDITED_AT' => '审核时间',
-        ];
-    }
-
-    /**
-     * 按期数获取会员总网业绩和大区剩余
-     * @param $userId
-     * @param $periodNum
-     * @return array
-     */
-    public static function getUserPerfAndPerfPeriod($userId,$periodNum){
-        $perfPeriod = PerfPeriod::findOneAsArray('USER_ID=:USER_ID AND PERIOD_NUM=:PERIOD_NUM', [':USER_ID' => $userId, ':PERIOD_NUM' => $periodNum]);
-        $userPerf = UserPerf::findOneAsArray('USER_ID=:USER_ID', [':USER_ID' => $userId]);
-        return ['SURPLUS_1L' => $perfPeriod['SURPLUS_1L'] ?? 0, 'SURPLUS_2L' => $perfPeriod['SURPLUS_2L'] ?? 0, 'SURPLUS_3L' => $perfPeriod['SURPLUS_3L'] ?? 0, 'SURPLUS_4L' => $perfPeriod['SURPLUS_4L'] ?? 0, 'SURPLUS_5L' => $perfPeriod['SURPLUS_5L'] ?? 0, 'SURPLUS_LS' => $perfPeriod['SURPLUS_LS'] ?? 0, 'PV_1L' => $userPerf['PV_1L'] ?? 0, 'PV_2L' => $userPerf['PV_2L'] ?? 0, 'PV_3L' => $userPerf['PV_3L'] ?? 0, 'PV_4L' => $userPerf['PV_4L'] ?? 0, 'PV_5L' => $userPerf['PV_5L'] ?? 0];
-    }
-
-    /**
-     * 操作日志记录条件
-     * @return array
-     */
-    public function attrLabelsWithLogType(){
-        return [
-            'USER_ID' => '会员ID',
-            'PV_1L' => '一市场累计',
-            'PV_2L' => '二市场累计',
-            'PV_3L' => '三市场累计',
-            'PV_4L' => '四市场累计',
-            'PV_5L' => '五市场累计',
-            'SURPLUS_1L' => '一市场结余',
-            'SURPLUS_2L' => '二市场结余',
-            'SURPLUS_3L' => '三市场结余',
-            'SURPLUS_4L' => '四市场结余',
-            'SURPLUS_5L' => '五市场结余',
-            'SURPLUS_LS' => '零售结余',
-            'PERF_TYPE' => [
-                'label' => '业绩类型',
-                'type' => function($data){
-                    $value = $data['value'];
-                    return self::CHANGE_PERF_TYPE[$value];
-                },
-            ],
-            'PERF_LOCATION' => [
-                'label' => '业绩区域',
-                'type' => function($data){
-                    $value = $data['value'];
-                    return self::PERF_LOCATION_NAME[$value];
-                },
-            ],
-            'AMOUNT' => '调整金额',
-            'PERF_BEFORE' => '业绩调整前',
-            'PERF_AFTER' => '业绩调整后',
-            'PERIOD_NUM' => '调整期数',
-            'AUDIT_STATUS' => [
-                'label' => '审核状态',
-                'type' => function($data){
-                    $value = $data['value'];
-                    $result = '';
-                    if($value == 'un' || $value == \Yii::$app->params['auditStatus']['un']['value']){
-                        $result = \Yii::$app->params['auditStatus']['un']['label'];
-                    } elseif($value == 'true' || $value == \Yii::$app->params['auditStatus']['true']['value']) {
-                        $result = \Yii::$app->params['auditStatus']['true']['label'];
-                    } elseif($value == 'false' || $value == \Yii::$app->params['auditStatus']['false']['value']) {
-                        $result = \Yii::$app->params['auditStatus']['false']['label'];
-                    } elseif($value == 'reject' || $value == \Yii::$app->params['auditStatus']['reject']['value']) {
-                        $result = \Yii::$app->params['auditStatus']['reject']['label'];
-                    }
-                    return $result;
-                },
-            ],
-            'CREATE_ADMIN' => [
-                'label' => '创建管理员',
-                'type' => function($data){
-                    $value = $data['value'];
-                    $result = Admin::findOneAsArray('ID=:ID', [':ID'=>$value], 'ADMIN_NAME');
-                    return $result['ADMIN_NAME'];
-                },
-            ],
-            'REMARK' => '备注',
-            'AUDIT_ADMIN' => [
-                'label' => '审核管理员',
-                'type' => function($data){
-                    $value = $data['value'];
-                    $result = Admin::findOneAsArray('ID=:ID', [':ID'=>$value], 'ADMIN_NAME');
-                    return $result['ADMIN_NAME'];
-                },
-            ],
-            'CREATED_AT' => [
-                'label' => '创建时间',
-                'type' => ValueTypeConfig::DATE_TIME_TYPE,
-            ],
-            'AUDITED_AT' => [
-                'label' => '审核时间',
-                'type' => ValueTypeConfig::DATE_TIME_TYPE,
-            ],
-        ];
-    }
-}

+ 0 - 53
common/models/PerfCompany.php

@@ -1,53 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%PERF_COMPANY}}".
- *
- * @property string $ID ID
- * @property string $PV 月总业绩
- * @property int $CALC_YEAR 结算年
- * @property int $CALC_MONTH 结算月
- * @property int $CREATED_AT 创建时间
- */
-class PerfCompany extends \common\components\ActiveRecord
-{
-    /**
-     * @inheritdoc
-     */
-    public static function tableName()
-    {
-        return '{{%PERF_COMPANY}}';
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function rules()
-    {
-        return [
-            [['PV'], 'number'],
-            [['CALC_YEAR', 'CALC_MONTH', 'CREATED_AT'], 'required'],
-            [['CALC_YEAR', 'CALC_MONTH', 'CREATED_AT'], 'integer'],
-            [['ID'], 'string', 'max' => 32],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'PV' => '月总业绩',
-            'CALC_YEAR' => '结算年',
-            'CALC_MONTH' => '结算月',
-            'CREATED_AT' => '创建时间',
-        ];
-    }
-}

+ 0 - 171
common/models/PerfMonth.php

@@ -1,171 +0,0 @@
-<?php
-
-namespace common\models;
-
-use common\helpers\Tool;
-use Yii;
-use common\libs\logging\operate\valueType\Config as ValueTypeConfig;
-
-/**
- * This is the model class for table "{{%PERF_MONTH}}".
- *
- * @property string $ID
- * @property string $USER_ID 会员ID
- * @property string $LAST_DEC_LV 结算时会员级别
- * @property string $LAST_EMP_LV 结算时会员聘级
- * @property int $LAST_STATUS 结算时会有状态
- * @property string $FX_AMOUNT_CASH 复消现金金额
- * @property string $PV_PCS 个人消费
- * @property string $PV_PCS_FX 个人复消业绩
- * @property string $PV_1L 一市场业绩
- * @property string $PV_2L 二市场业绩
- * @property string $PV_3L 三市场业绩
- * @property string $PV_4L 四市场业绩
- * @property string $PV_5L 五市场业绩
- * @property string $VIP_PV_1L_ZC VIP一市场报单业绩
- * @property string $VIP_PV_2L_ZC VIP二市场报单业绩
- * @property string $VIP_PV_3L_ZC VIP三市场报单业绩
- * @property string $VIP_PV_4L_ZC VIP四市场报单业绩
- * @property string $VIP_PV_5L_ZC VIP五市场报单业绩
- * @property string $VIP_SURPLUS_1L_ZC VIP一市场剩余报单业绩
- * @property string $VIP_SURPLUS_2L_ZC VIP二市场剩余报单业绩
- * @property string $VIP_SURPLUS_3L_ZC VIP三市场剩余报单业绩
- * @property string $VIP_SURPLUS_4L_ZC VIP四市场剩余报单业绩
- * @property string $VIP_SURPLUS_5L_ZC VIP五市场剩余报单业绩
- * @property string $PV_1L_TOTAL 一市场历史累计加该月业绩
- * @property string $PV_2L_TOTAL 二市场历史累计加该月业绩
- * @property string $PV_3L_TOTAL 三市场历史累计加该月业绩
- * @property string $PV_4L_TOTAL 四市场历史累计加该月业绩
- * @property string $PV_5L_TOTAL 五市场历史累计加该月业绩
- * @property int $CF_PERCENT 车房养老奖分工系数
- * @property int $LX_PERCENT 领袖分红分工系数
- * @property int $FX_STATUS 本月复销状态作为下月发奖资格
- * @property int $CALC_MONTH 结算月
- * @property string $P_CALC_MONTH 表分区日期索引
- * @property int $CREATED_AT 创建时间
- */
-class PerfMonth extends \common\components\ActiveRecord
-{
-    const NEXT_MONTH_FX_TRUE = 1;
-    const NEXT_MONTH_FX_FALSE = 0;
-
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%PERF_MONTH}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['USER_ID', 'CALC_MONTH', 'P_CALC_MONTH', 'CREATED_AT'], 'required'],
-            [['LAST_STATUS', 'CF_PERCENT', 'LX_PERCENT', 'FX_STATUS', 'CALC_MONTH', 'CREATED_AT'], 'integer'],
-            [['FX_AMOUNT_CASH', 'PV_PCS', 'PV_PCS_FX', 'PV_1L', 'PV_2L', 'PV_3L', 'PV_4L', 'PV_5L', 'VIP_PV_1L_ZC', 'VIP_PV_2L_ZC',  'VIP_PV_3L_ZC', 'VIP_PV_4L_ZC', 'VIP_PV_5L_ZC', 'VIP_SURPLUS_1L_ZC', 'VIP_SURPLUS_2L_ZC', 'VIP_SURPLUS_3L_ZC', 'VIP_SURPLUS_4L_ZC', 'VIP_SURPLUS_5L_ZC', 'PV_1L_TOTAL', 'PV_2L_TOTAL', 'PV_3L_TOTAL', 'PV_4L_TOTAL', 'PV_5L_TOTAL'], 'number'],
-            [['ID', 'USER_ID', 'LAST_DEC_LV', 'LAST_EMP_LV'], 'string', 'max' => 32],
-            [['P_CALC_MONTH'], 'safe'],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_ID' => '会员ID',
-            'LAST_DEC_LV' => '结算时会员级别',
-            'LAST_EMP_LV' => '结算时会员聘级',
-            'LAST_STATUS' => '结算时会有状态',
-            'FX_AMOUNT_CASH' => '复消现金金额',
-            'PV_PCS' => '个人消费',
-            'PV_PCS_FX' => '个人复消业绩',
-            'PV_1L' => '一市场业绩',
-            'PV_2L' => '二市场业绩',
-            'PV_3L' => '三市场业绩',
-            'PV_4L' => '四市场业绩',
-            'PV_5L' => '五市场业绩',
-            'VIP_PV_1L_ZC' => 'VIP一市场报单业绩',
-            'VIP_PV_2L_ZC' => 'VIP二市场报单业绩',
-            'VIP_PV_3L_ZC' => 'VIP三市场报单业绩',
-            'VIP_PV_4L_ZC' => 'VIP四市场报单业绩',
-            'VIP_PV_5L_ZC' => 'VIP五市场报单业绩',
-            'VIP_SURPLUS_1L_ZC' => 'VIP一市场剩余报单业绩',
-            'VIP_SURPLUS_2L_ZC' => 'VIP二市场剩余报单业绩',
-            'VIP_SURPLUS_3L_ZC' => 'VIP三市场剩余报单业绩',
-            'VIP_SURPLUS_4L_ZC' => 'VIP四市场剩余报单业绩',
-            'VIP_SURPLUS_5L_ZC' => 'VIP五市场剩余报单业绩',
-            'PV_1L_TOTAL' => '一市场历史累计加该月业绩',
-            'PV_2L_TOTAL' => '二市场历史累计加该月业绩',
-            'PV_3L_TOTAL' => '三市场历史累计加该月业绩',
-            'PV_4L_TOTAL' => '四市场历史累计加该月业绩',
-            'PV_5L_TOTAL' => '五市场历史累计加该月业绩',
-            'CF_PERCENT' => '车房养老奖分工系数',
-            'LX_PERCENT' => '领袖分红分工系数',
-            'FX_STATUS' => '本月复销状态作为下月发奖资格',
-            'CALC_MONTH' => '结算月',
-            'P_CALC_MONTH' => '表分区日期索引',
-            'CREATED_AT' => '创建时间',
-        ];
-    }
-
-    /**
-     * 获取会员的月业绩总和
-     * @param $yearMonth
-     * @param $userId
-     * @return array|null|\yii\db\ActiveRecord
-     */
-    public static function getMonthPerf($yearMonth, $userId){
-        $result = static::find()->yearMonth($yearMonth)->where('USER_ID=:USER_ID', [':USER_ID'=>$userId])->asArray()->one();
-        if(!$result){
-            $result = [
-                'USER_ID' => $userId,
-                'FX_AMOUNT_CASH' => 0,
-                'PV_PCS' => 0,
-                'PV_PSS' => 0,
-                'PV_1L' => 0,
-                'PV_2L' => 0,
-                'PV_3L' => 0,
-                'PV_4L' => 0,
-                'PV_5L' => 0,
-                'PV_1L_TOTAL' => 0,
-                'PV_2L_TOTAL' => 0,
-                'PV_3L_TOTAL' => 0,
-                'PV_4L_TOTAL' => 0,
-                'PV_5L_TOTAL' => 0,
-                'PV_PSS_TOTAL' => 0,
-                'DEC_LEVEL' => null,
-                'EMP_LEVEL' => null,
-                'CF_PERCENT' => 0,
-                'LX_PERCENT' => 0,
-                'FX_STATUS' => self::NEXT_MONTH_FX_FALSE,
-            ];
-        }
-        $result['PV_TOTAL'] = Tool::formatPrice($result['PV_1L_TOTAL']+$result['PV_2L_TOTAL']+$result['PV_3L_TOTAL']+$result['PV_4L_TOTAL']+$result['PV_5L_TOTAL']);
-        return $result;
-    }
-
-    /**
-     * 操作日志记录条件
-     * @return array
-     */
-    public function attrLabelsWithLogType(){
-        return [
-            'USER_ID' => '会员ID',
-            'FX_STATUS' => [
-                'label' => '复销资格',
-                'type' => function($data){
-                    $value = $data['value'];
-                    return $value==1?'是':'否';
-                },
-            ],
-            'CALC_MONTH' => '结算月',
-        ];
-    }
-}

+ 0 - 130
common/models/PerfOrder.php

@@ -1,130 +0,0 @@
-<?php
-
-namespace common\models;
-
-use common\helpers\snowflake\SnowFake;
-use common\helpers\Tool;
-use Yii;
-use yii\base\Exception;
-
-/**
- * This is the model class for table "{{%PERF_ORDER}}".
- *
- * @property string $ID
- * @property string $SN 业绩单编号
- * @property string $DEC_SN 报单编号
- * @property string $DEC_TYPE 报单类型
- * @property int $DEC_STATUS 业绩单状态
- * @property string $USER_ID 产生业绩会员ID
- * @property string $LAST_DEC_LV 结算时会员级别
- * @property string $LAST_EMP_LV 结算时会员聘级
- * @property int $LAST_STATUS 结算时状态
- * @property string $LAST_REC_USER_NAME 结算时开拓者编号
- * @property string $LAST_REC_REAL_NAME 结算时开拓者姓名
- * @property string $PV 业绩单PV
- * @property string $DEC_AMOUNT 报单金额
- * @property string $LAST_SUB_COM_ID 结算时所属分公司
- * @property int $LAST_PROVINCE 结算时省份
- * @property int $LAST_CITY 结算时城市
- * @property int $LAST_COUNTY 结算时地区
- * @property string $DEC_USER_ID 报单主体ID
- * @property string $LAST_DEC_DEC_LV 结算时报单主体级别
- * @property string $LAST_DEC_SUB_COM_ID 结算时报单主体所属分公司
- * @property int $LAST_DEC_PROVINCE 结算时报单主体省份
- * @property int $LAST_DEC_CITY 结算时报单主体城市
- * @property int $LAST_DEC_COUNTY 结算时报单主体地区
- * @property int $PERIOD_NUM 所在期数
- * @property int $CALC_MONTH 结算月
- * @property string $P_CALC_MONTH 分区结算月
- * @property int $CREATED_AT 创建时间
- * @property int $CLOSED_AT 置废时间
- */
-class PerfOrder extends \common\components\ActiveRecord
-{
-    //业绩单状态
-    const STATUS_NORMAL = 1; //正常
-    const STATUS_CLOSED = 2; //置废
-    const STATUS_NAME = [
-      self::STATUS_NORMAL=>'已审核',
-      self::STATUS_CLOSED=>'置废',
-    ];
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%PERF_ORDER}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['SN', 'DEC_TYPE', 'USER_ID', 'PERIOD_NUM', 'CALC_MONTH', 'P_CALC_MONTH', 'CREATED_AT', 'CLOSED_AT'], 'required'],
-            [['LAST_STATUS', 'DEC_STATUS', 'LAST_PROVINCE', 'LAST_CITY', 'LAST_COUNTY', 'LAST_DEC_PROVINCE', 'LAST_DEC_CITY', 'LAST_DEC_COUNTY', 'PERIOD_NUM', 'CALC_MONTH', 'CREATED_AT', 'CLOSED_AT'], 'integer'],
-            [['PV', 'DEC_AMOUNT'], 'number'],
-            [['ID', 'USER_ID', 'LAST_DEC_LV','LAST_EMP_LV', 'LAST_SUB_COM_ID', 'DEC_USER_ID', 'LAST_DEC_DEC_LV', 'LAST_DEC_SUB_COM_ID'], 'string', 'max' => 32],
-            [['SN', 'DEC_SN', 'DEC_TYPE'], 'string', 'max' => 32],
-            [['LAST_REC_USER_NAME'], 'string', 'max' => 16],
-            [['LAST_REC_REAL_NAME'], 'string', 'max' => 128],
-            [['P_CALC_MONTH'], 'string', 'max' => 7],
-            [['SN'], 'unique'],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'SN' => '业绩单编号',
-            'DEC_SN' => '报单编号',
-            'DEC_TYPE' => '报单类型',
-            'DEC_STATUS' => '业绩单状态',
-            'USER_ID' => '产生业绩会员ID',
-            'LAST_DEC_LV' => '结算时会员级别',
-            'LAST_EMP_LV' => '结算时会员聘级',
-            'LAST_STATUS' => '结算时状态',
-            'LAST_REC_USER_NAME' => '结算时开拓者编号',
-            'LAST_REC_REAL_NAME' => '结算时开拓者姓名',
-            'PV' => '业绩单PV',
-            'DEC_AMOUNT' => '报单金额',
-            'LAST_SUB_COM_ID' => '结算时所属分公司',
-            'LAST_PROVINCE' => '结算时省份',
-            'LAST_CITY' => '结算时城市',
-            'LAST_COUNTY' => '结算时地区',
-            'DEC_USER_ID' => '报单主体ID',
-            'LAST_DEC_DEC_LV' => '结算时报单主体级别',
-            'LAST_DEC_SUB_COM_ID' => '结算时报单主体所属分公司',
-            'LAST_DEC_PROVINCE' => '结算时报单主体省份',
-            'LAST_DEC_CITY' => '结算时报单主体城市',
-            'LAST_DEC_COUNTY' => '结算时报单主体地区',
-            'PERIOD_NUM' => '所在期数',
-            'CALC_MONTH' => '结算月',
-            'P_CALC_MONTH' => '分区结算月',
-            'CREATED_AT' => '创建时间',
-            'CLOSED_AT' => '置废时间',
-        ];
-    }
-
-    /**
-     * 获取当前最大的订单编号
-     * @return mixed
-     */
-    public static function getMaxSn(){
-        return static::find()->where('1=1')->max('SN');
-    }
-
-    /**
-     * 生成sn
-     * @return string
-     */
-    public static function generateSN() {
-        return  SnowFake::instance()->generateId();
-    }
-}

+ 0 - 191
common/models/Recharge.php

@@ -1,191 +0,0 @@
-<?php
-
-namespace common\models;
-
-use common\helpers\user\Info;
-use Yii;
-
-/**
- * This is the model class for table "{{%RECHARGE}}".
- *
- * @property string $ID
- * @property string $SN 单号
- * @property string $USER_ID 会员ID
- * @property string $ID_CARD 身份证号
- * @property int $RECHARGE_PERIOD_NUM 充值期数
- * @property int $RECHARGE_YEAR 充值年份
- * @property int $RECHARGE_MONTH 充值月份
- * @property string $AMOUNT 充值金额
- * @property string $REAL_NAME 会员姓名
- * @property string $OPEN_BANK 开户行
- * @property string $BANK_ADDRESS 开户支行
- * @property string $BANK_NO 银行账号
- * @property int $BANK_PROVINCE 银行省份
- * @property int $BANK_CITY 银行城市
- * @property int $BANK_COUNTY 银行地区
- * @property string $BANK_PROVE 打款凭证
- * @property string $P_MONTH 表分区标识
- * @property int $AUDIT_STATUS 审核状态
- * @property string $REMARK 审核备注
- * @property string $AUDIT_ADMIN 审核管理员
- * @property int $CREATED_AT 创建时间
- * @property int $AUDITED_AT 审核时间
- */
-class Recharge extends \common\components\ActiveRecord {
-    const TYPE_MANUAL = 0;      // 手动充值
-    const TYPE_AUTO = 1;        // 自动充值
-    const TYPE_ADMIN = 2;       // 后台管理员
-
-
-    const STATUS_APPLIED = 0;       // 已申请
-    const STATUS_PROVED = 1;       // 已上传凭证
-    const STATUS_AUDITED = 2;       // 已审核
-    const STATUS_REFUSED = 3;       // 已拒绝
-
-    const STATUS_NAME = [
-        self::STATUS_APPLIED => '待审核',
-        self::STATUS_PROVED => '已上传凭证',
-        self::STATUS_AUDITED => '已审核',
-        self::STATUS_REFUSED => '已拒绝',
-    ];
-
-    /**
-     * @inheritdoc
-     */
-    public static function tableName() {
-        return '{{%RECHARGE}}';
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function rules() {
-        return [
-            [['USER_ID', 'P_MONTH', 'CREATED_AT'], 'required'],
-            [['RECHARGE_PERIOD_NUM', 'RECHARGE_YEAR', 'RECHARGE_MONTH', 'AUDIT_STATUS', 'CREATED_AT', 'AUDITED_AT', 'BANK_PROVINCE', 'BANK_CITY', 'BANK_COUNTY'], 'integer'],
-            [['AMOUNT'], 'number'],
-            [['ID', 'SN', 'USER_ID', 'OPEN_BANK', 'BANK_NO', 'AUDIT_ADMIN'], 'string', 'max' => 32],
-            [['ID_CARD'], 'string', 'max' => 20],
-            [['REAL_NAME', 'BANK_ADDRESS'], 'string', 'max' => 255],
-            [['REMARK'], 'string', 'max' => 4000],
-            [['ID'], 'unique'],
-            [['SN'], 'unique'],
-        ];
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function attributeLabels() {
-        return [
-            'ID' => 'ID',
-            'SN' => '单号',
-            'USER_ID' => '会员ID',
-            'ID_CARD' => '身份证号',
-            'RECHARGE_PERIOD_NUM' => '充值期数',
-            'RECHARGE_YEAR' => '充值年份',
-            'RECHARGE_MONTH' => '充值月份',
-            'AMOUNT' => '充值金额',
-            'REAL_NAME' => '会员姓名',
-            'OPEN_BANK' => '汇款银行',
-            'BANK_ADDRESS' => '开户支行',
-            'BANK_NO' => '汇款账号',
-            'BANK_PROVINCE' => '银行省份',
-            'BANK_CITY' => '银行城市',
-            'BANK_COUNTY' => '银行地区',
-            'BANK_PROVE' => '打款凭证',
-            'P_MONTH' => '表分区标识',
-            'AUDIT_STATUS' => '审核状态',
-            'REMARK' => '备注',
-            'AUDIT_ADMIN' => '审核管理员',
-            'CREATED_AT' => '创建时间',
-            'AUDITED_AT' => '审核时间',
-        ];
-    }
-
-    /**
-     * 获取充值相关期数,目前按照直接取当月第一期来实现
-     * @param $nowTime
-     * @return array
-     */
-    public static function getPeriod($nowTime) {
-        $period = Period::instance();
-        $year = $period->getNowYear();
-        $month = $period->getNowMonth();
-        $yearMonth = $period->getNowYearMonth();
-        $thisMonth = Period::getPeriodNumRangeFromMonth($year, $month);
-        $period->setPeriodNum($thisMonth['min']);
-        $endTime = $period->getNowPeriodEnd();
-        return ['nowPeriodNum' => $thisMonth['min'], 'nowYear' => $year, 'nowMonth' => $month, 'yearMonth'=>$yearMonth, 'endTime' => $endTime];
-    }
-
-    /**
-     * 会员本月是否充值
-     * @param $uid
-     * @return bool
-     */
-    public static function hasThisMonthRecharge($uid) {
-        $period = Period::instance();
-        $idCard = Info::getIdCardByUserId($uid);
-        if ($idCard) {
-            if (static::find()->where('ID_CARD=:ID_CARD AND RECHARGE_YEAR=:RECHARGE_YEAR AND RECHARGE_MONTH=:RECHARGE_MONTH', [':ID_CARD' => $idCard, ':RECHARGE_YEAR' => $period->getNowYear(), ':RECHARGE_MONTH' => $period->getNowMonth()])->exists()) {
-                return true;
-            }
-        } else {
-            if (static::find()->where('USER_ID=:USER_ID AND RECHARGE_YEAR=:RECHARGE_YEAR AND RECHARGE_MONTH=:RECHARGE_MONTH', [':USER_ID' => $uid, ':RECHARGE_YEAR' => $period->getNowYear(), ':RECHARGE_MONTH' => $period->getNowMonth()])->exists()) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * 判断充值状态
-     * @param $sn
-     * @param $nowStatus
-     * @param $toStatus
-     * @return string
-     */
-    public static function chkAuditStatus($sn, $nowStatus, $toStatus) {
-        $statusName = self::STATUS_NAME;
-        $msg = '充值单' . $sn . '当前状态为【' . $statusName[$nowStatus] . '】,无法设置为【' . $statusName[$toStatus] . '】';
-        switch ($toStatus) {
-            //已审核
-            case Recharge::STATUS_AUDITED:
-                if (($nowStatus == Recharge::STATUS_APPLIED) || ($nowStatus == Recharge::STATUS_PROVED)) {
-                    $msg = '';
-                }
-                break;
-            //审核拒绝
-            case Recharge::STATUS_REFUSED:
-                if (($nowStatus == Recharge::STATUS_APPLIED) || ($nowStatus == Recharge::STATUS_PROVED)) {
-                    $msg = '';
-                }
-                break;
-            default:
-        }
-        return $msg;
-    }
-
-    /**
-     * 按充值状态返回总和
-     * @param $userId
-     * @param int $type
-     * @return mixed
-     */
-    public static function getRechargeTotal($userId, $type = self::STATUS_AUDITED) {
-        $total = self::find()->where('USER_ID=:USER_ID AND AUDIT_STATUS=:AUDIT_STATUS', [':USER_ID' => $userId, ':AUDIT_STATUS' => $type])->sum('AMOUNT');
-        return $total ? $total : '0.00';
-    }
-
-    /**
-     * 按充值状态返回所有会员总和
-     * @param int $type
-     * @return mixed
-     */
-    public static function getAllRechargeTotal($type = self::STATUS_AUDITED) {
-        $total = self::find()->where('AUDIT_STATUS=:AUDIT_STATUS', [':AUDIT_STATUS' => $type])->sum('AMOUNT');
-        return $total ? $total : '0.00';
-    }
-
-}

+ 0 - 78
common/models/RegInfoAudit.php

@@ -1,78 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%REG_INFO_AUDIT}}".
- *
- * @property string $ID
- * @property string $USER_ID 会员ID
- * @property string $REG_TYPE 注册类型
- * @property string $REG_NAME 注册名称
- * @property string $CREDIT_CODE 统一社会信用代码
- * @property string $PREMISES 经营场所
- * @property string $LEGAL_PERSON 法人
- * @property int $REG_EXPIRES 注册有效期
- * @property int $AUDIT_STATUS 审核状态
- * @property string $CREATE_ADMIN 创建管理员
- * @property string $AUDIT_ADMIN 审核管理员
- * @property string $CREATE_REMARK 申请备注
- * @property string $AUDIT_REMARK 审核备注
- * @property int $CREATE_PERIOD 创建期数
- * @property int $AUDIT_PERIOD 审核期数
- * @property int $CREATED_AT 创建时间
- * @property int $AUDITED_AT 审核时间
- */
-class RegInfoAudit extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%REG_INFO_AUDIT}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['USER_ID', 'REG_TYPE', 'REG_NAME', 'CREDIT_CODE', 'REG_EXPIRES', 'CREATE_ADMIN', 'CREATED_AT'], 'required'],
-            [['REG_EXPIRES', 'AUDIT_STATUS', 'CREATE_PERIOD', 'AUDIT_PERIOD', 'CREATED_AT', 'AUDITED_AT'], 'integer'],
-            [['ID', 'USER_ID', 'REG_TYPE', 'CREATE_ADMIN', 'AUDIT_ADMIN'], 'string', 'max' => 32],
-            [['REG_NAME', 'CREDIT_CODE', 'PREMISES', 'LEGAL_PERSON'], 'string', 'max' => 255],
-            [['CREATE_REMARK', 'AUDIT_REMARK'], 'string', 'max' => 4000],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_ID' => 'User  ID',
-            'REG_TYPE' => 'Reg  Type',
-            'REG_NAME' => 'Reg  Name',
-            'CREDIT_CODE' => 'Credit  Code',
-            'PREMISES' => 'Premises',
-            'LEGAL_PERSON' => 'Legal  Person',
-            'REG_EXPIRES' => 'Reg  Expires',
-            'AUDIT_STATUS' => 'Audit  Status',
-            'CREATE_ADMIN' => 'Create  Admin',
-            'AUDIT_ADMIN' => 'Audit  Admin',
-            'CREATE_REMARK' => 'Create  Remark',
-            'AUDIT_REMARK' => 'Audit  Remark',
-            'CREATE_PERIOD' => 'Create  Period',
-            'AUDIT_PERIOD' => 'Audit  Period',
-            'CREATED_AT' => 'Created  At',
-            'AUDITED_AT' => 'Audited  At',
-        ];
-    }
-}

+ 0 - 139
common/models/ResendQY.php

@@ -1,139 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-use common\libs\logging\operate\valueType\Config as ValueTypeConfig;
-
-/**
- * This is the model class for table "{{%RESEND_QY}}".
- *
- * @property string $ID
- * @property string $USER_ID 会员ID
- * @property string $LAST_DEC_LV 结算时会员级别
- * @property string $LAST_EMP_LV 结算时会员聘级
- * @property int $LAST_STATUS 结算时状态
- * @property string $LAST_SUB_COM_ID 结算时所属分公司
- * @property int $LAST_PROVINCE 结算时所属省份
- * @property int $LAST_CITY 结算时所属城市
- * @property int $LAST_COUNTY 结算时所属地区
- * @property string $LAST_SYSTEM_ID 结算时体系
- * @property string $BONUS_QY 区域津贴
- * @property string $SHOULD_QY 应发区域津贴
- * @property string $QY_1L 一市场区域业绩
- * @property string $SURPLUS_1L 一市场结余业绩
- * @property string $QY_2L 二市场区域业绩
- * @property string $SURPLUS_2L 二市场结余业绩
- * @property string $QY_3L 三市场区域业绩
- * @property string $SURPLUS_3L 三市场结余业绩
- * @property string $QY_4L 四市场区域业绩
- * @property string $SURPLUS_4L 四市场结余业绩
- * @property string $QY_5L 五市场区域业绩
- * @property string $SURPLUS_5L 五市场结余业绩
- * @property string $QY_LS 虚拟零售区区域业绩
- * @property string $SURPLUS_LS 虚拟零售区结余
- * @property int $PERIOD_NUM 结算期数
- * @property int $CALC_YEAR 所在结算年
- * @property int $CALC_MONTH 所在结算月
- * @property int $RESEND_STATUS 补发状态
- * @property string $RESEND_AUDIT_ID 审核对应ID
- * @property int $RESEND_AUDIT_STATUS 审核状态
- * @property string $P_CALC_MONTH 表分区的日期索引
- * @property int $CREATED_AT 创建时间
- */
-class ResendQY extends \common\components\ActiveRecord
-{
-    const STATUS_WAIT = 0;
-    const STATUS_HAS = 1;
-    const STATUS_NAME = [
-        self::STATUS_WAIT => '待申请补发',
-        self::STATUS_HAS => '已申请补发',
-    ];
-
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%RESEND_QY}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['USER_ID', 'LAST_SYSTEM_ID', 'PERIOD_NUM', 'CALC_YEAR', 'CALC_MONTH', 'P_CALC_MONTH', 'CREATED_AT'], 'required'],
-            [['LAST_STATUS', 'LAST_PROVINCE', 'LAST_CITY', 'LAST_COUNTY', 'PERIOD_NUM', 'CALC_YEAR', 'CALC_MONTH', 'RESEND_STATUS', 'RESEND_AUDIT_STATUS', 'CREATED_AT'], 'integer'],
-            [['BONUS_QY', 'SHOULD_QY', 'QY_1L', 'SURPLUS_1L', 'QY_2L', 'SURPLUS_2L', 'QY_3L', 'SURPLUS_3L', 'QY_4L', 'SURPLUS_4L', 'QY_5L', 'SURPLUS_5L', 'QY_LS', 'SURPLUS_LS'], 'number'],
-            [['ID', 'USER_ID', 'LAST_DEC_LV', 'LAST_EMP_LV', 'LAST_SUB_COM_ID', 'LAST_SYSTEM_ID', 'RESEND_AUDIT_ID'], 'string', 'max' => 32],
-            [['P_CALC_MONTH'], 'safe'],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_ID' => '会员ID',
-            'LAST_DEC_LV' => '结算时会员级别',
-            'LAST_EMP_LV' => '结算时会员聘级',
-            'LAST_STATUS' => '结算时状态',
-            'LAST_SUB_COM_ID' => '结算时所属分公司',
-            'LAST_PROVINCE' => '结算时所属省份',
-            'LAST_CITY' => '结算时所属城市',
-            'LAST_COUNTY' => '结算时所属地区',
-            'LAST_SYSTEM_ID' => '结算时体系',
-            'BONUS_QY' => '区域津贴',
-            'SHOULD_QY' => '应发区域津贴',
-            'QY_1L' => '一市场区域业绩',
-            'SURPLUS_1L' => '一市场结余业绩',
-            'QY_2L' => '二市场区域业绩',
-            'SURPLUS_2L' => '二市场结余业绩',
-            'QY_3L' => '三市场区域业绩',
-            'SURPLUS_3L' => '三市场结余业绩',
-            'QY_4L' => '四市场区域业绩',
-            'SURPLUS_4L' => '四市场结余业绩',
-            'QY_5L' => '五市场区域业绩',
-            'SURPLUS_5L' => '五市场结余业绩',
-            'QY_LS' => '虚拟零售区区域业绩',
-            'SURPLUS_LS' => '虚拟零售区结余',
-            'PERIOD_NUM' => '结算期数',
-            'CALC_YEAR' => '所在结算年',
-            'CALC_MONTH' => '所在结算月',
-            'RESEND_STATUS' => '补发状态',
-            'RESEND_AUDIT_ID' => '审核对应ID',
-            'RESEND_AUDIT_STATUS' => '审核状态',
-            'P_CALC_MONTH' => '表分区的日期索引',
-            'CREATED_AT' => '创建时间',
-        ];
-    }
-
-    /**
-     * 操作日志记录条件
-     * @return array
-     */
-    public function attrLabelsWithLogType(){
-        return [
-            'USER_ID' => '会员ID',
-            'BONUS_QY' => '区域津贴',
-            'SHOULD_QY' => '应发区域津贴',
-            'RESEND_STATUS' => [
-                'label' => '补发状态',
-                'type' => function($data){
-                    $value = $data['value'];
-                    return self::STATUS_NAME[$value];
-                },
-            ],
-            'RESEND_AUDIT_STATUS' => [
-                'label' => '审核状态',
-                'type' => ValueTypeConfig::AUDIT_STATUS_TYPE,
-            ],
-        ];
-    }
-}

+ 0 - 88
common/models/ResendQYAudit.php

@@ -1,88 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-use common\libs\logging\operate\valueType\Config as ValueTypeConfig;
-
-/**
- * This is the model class for table "{{%RESEND_QY_AUDIT}}".
- *
- * @property string $ID
- * @property string $USER_ID 会员ID
- * @property string $RESEND_ID 补发表ID
- * @property string $SHOULD_BONUS 应发金额
- * @property string $RESEND_BONUS 补发金额
- * @property int $PERIOD_NUM 补发期数
- * @property int $AUDIT_STATUS 审核状态
- * @property string $RESEND_ADMIN_ID 补发管理员ID
- * @property string $AUDIT_ADMIN_ID 审核管理员ID
- * @property string $RESEND_REMARK 补发备注
- * @property string $AUDIT_REMARK 审核备注
- * @property int $CREATED_AT 创建时间
- * @property int $AUDITED_AT 审核时间
- */
-class ResendQYAudit extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%RESEND_QY_AUDIT}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['USER_ID', 'RESEND_ID', 'PERIOD_NUM', 'RESEND_ADMIN_ID', 'CREATED_AT'], 'required'],
-            [['SHOULD_BONUS', 'RESEND_BONUS'], 'number'],
-            [['PERIOD_NUM', 'AUDIT_STATUS', 'CREATED_AT', 'AUDITED_AT'], 'integer'],
-            [['ID', 'USER_ID', 'RESEND_ID', 'RESEND_ADMIN_ID', 'AUDIT_ADMIN_ID'], 'string', 'max' => 32],
-            [['RESEND_REMARK', 'AUDIT_REMARK'], 'string', 'max' => 4000],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_ID' => '会员ID',
-            'RESEND_ID' => '补发表ID',
-            'SHOULD_BONUS' => '应发金额',
-            'RESEND_BONUS' => '补发金额',
-            'PERIOD_NUM' => '补发期数',
-            'AUDIT_STATUS' => '审核状态',
-            'RESEND_ADMIN_ID' => '补发管理员ID',
-            'AUDIT_ADMIN_ID' => '审核管理员ID',
-            'RESEND_REMARK' => '补发备注',
-            'AUDIT_REMARK' => '审核备注',
-            'CREATED_AT' => '创建时间',
-            'AUDITED_AT' => '审核时间',
-        ];
-    }
-
-    /**
-     * 操作日志记录条件
-     * @return array
-     */
-    public function attrLabelsWithLogType(){
-        return [
-            'USER_ID' => '会员ID',
-            'SHOULD_BONUS' => '应发金额',
-            'RESEND_BONUS' => '补发金额',
-            'PERIOD_NUM' => '补发期数',
-            'AUDIT_STATUS' => [
-                'label' => '审核状态',
-                'type' => ValueTypeConfig::AUDIT_STATUS_TYPE,
-            ],
-        ];
-    }
-}

+ 0 - 61
common/models/ScoreMonth.php

@@ -1,61 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%SCORE_MONTH}}".
- *
- * @property string $ID ID
- * @property string $USER_ID 会员ID
- * @property string $BASE_SCORE 基础分数
- * @property string $LEVEL_SCORE 级别分数
- * @property string $UPGRADE_SCORE 升级分数
- * @property string $TOTAL_SCORE 总分数
- * @property int $PERIOD_NUM 期数
- * @property int $CALC_MONTH 结算月
- * @property int $CREATED_AT 创建时间
- */
-class ScoreMonth extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%SCORE_MONTH}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['ID', 'USER_ID', 'CALC_MONTH', 'CREATED_AT'], 'required'],
-            [['BASE_SCORE', 'LEVEL_SCORE', 'UPGRADE_SCORE', 'TOTAL_SCORE'], 'number'],
-            [['PERIOD_NUM', 'CALC_MONTH', 'CREATED_AT'], 'integer'],
-            [['ID', 'USER_ID'], 'string', 'max' => 32],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_ID' => '会员ID',
-            'BASE_SCORE' => '基础分数',
-            'LEVEL_SCORE' => '级别分数',
-            'UPGRADE_SCORE' => '升级分数',
-            'TOTAL_SCORE' => '总分数',
-            'PERIOD_NUM' => '期数',
-            'CALC_MONTH' => '结算月',
-            'CREATED_AT' => '创建时间',
-        ];
-    }
-}

+ 0 - 137
common/models/SmsApi.php

@@ -1,137 +0,0 @@
-<?php
-
-namespace common\models;
-
-use common\helpers\Cache;
-use Yii;
-use yii\helpers\Json;
-
-/**
- * This is the model class for table "{{%SMS_API}}".
- *
- * @property string $ID
- * @property string $API_NAME 接口名称
- * @property string $DESCRIPTION 描述
- * @property string $CONFIG 设置内容
- * @property int $STATUS 状态
- * @property string $CREATE_ADMIN 创建管理员
- * @property string $UPDATE_ADMIN 更新管理员
- * @property int $CREATED_AT 创建时间
- * @property int $UPDATED_AT 更新时间
- */
-class SmsApi extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%SMS_API}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['API_NAME', 'DESCRIPTION', 'CREATE_ADMIN', 'CREATED_AT'], 'required'],
-            [['STATUS', 'CREATED_AT', 'UPDATED_AT'], 'integer'],
-            [['ID', 'CREATE_ADMIN', 'UPDATE_ADMIN'], 'string', 'max' => 32],
-            [['API_NAME'], 'string', 'max' => 48],
-            [['DESCRIPTION'], 'string', 'max' => 255],
-            [['CONFIG'], 'string', 'max' => 4000],
-            [['API_NAME'], 'unique'],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'API_NAME' => '接口名称',
-            'DESCRIPTION' => '描述',
-            'CONFIG' => '设置内容',
-            'STATUS' => '状态',
-            'CREATE_ADMIN' => '创建管理员',
-            'UPDATE_ADMIN' => '更新管理员',
-            'CREATED_AT' => '创建时间',
-            'UPDATED_AT' => '更新时间',
-        ];
-    }
-
-    /**
-     * 获取全部数据
-     * @return array|\yii\db\ActiveRecord[]
-     */
-    public static function getAllData(){
-        $allData = static::find()->where('1=1')->orderBy('CREATED_AT ASC')->indexBy('API_NAME')->asArray()->all();
-        foreach($allData as $key=>$data){
-            if($data['CONFIG']){
-                $allData[$key]['CONFIG'] = Json::decode($data['CONFIG']);
-            } else{
-                $allData[$key]['CONFIG'] = [];
-            }
-        }
-        return $allData;
-    }
-
-    /**
-     * 获取当前正在启用的接口
-     * @return array
-     */
-    public static function getActiveData(){
-        $data = static::find()->where('STATUS=:STATUS', [':STATUS' => 1])->orderBy('CREATED_AT ASC')->asArray()->one();
-        if($data['CONFIG']){
-            $data['CONFIG'] = Json::decode($data['CONFIG']);
-        } else {
-            $data['CONFIG'] = null;
-        }
-        return $data;
-    }
-
-    /**
-     * 从缓存获取信息
-     * @return array|mixed|\yii\db\ActiveRecord[]
-     */
-    public static function getFromCache(){
-        $data = Yii::$app->cache->get(Cache::SMS_API_CONFIG_KEY);
-        if(!$data){
-            // 获取信息
-            $data = self::getActiveData();
-            Yii::$app->cache->set(Cache::SMS_API_CONFIG_KEY, $data);
-        }
-        return $data;
-    }
-
-    /**
-     *  更新缓存
-     * @return array|\yii\db\ActiveRecord[]
-     */
-    public static function updateToCache(){
-        // 获取配置
-        $data = self::getActiveData();
-        Yii::$app->cache->set(Cache::SMS_API_CONFIG_KEY, $data);
-        return $data;
-    }
-
-    /**
-     * 按id获取配置
-     * @param $id
-     * @return array
-     */
-    public static function getConfigById($id) {
-        $smsApi = self::findOneAsArray('ID=:ID',[':ID'=>$id],'CONFIG');
-        $config = json_decode($smsApi['CONFIG'],true);
-        $data = [];
-        foreach ($config as $key=>$value){
-            $data[$key]['label'] = $key;
-            $data[$key]['value'] = $value;
-        }
-        return $data;
-    }
-}

+ 0 - 149
common/models/SmsTemplate.php

@@ -1,149 +0,0 @@
-<?php
-
-namespace common\models;
-
-use common\helpers\Cache;
-use Yii;
-
-/**
- * This is the model class for table "{{%SMS_TEMPLATE}}".
- *
- * @property string $ID
- * @property string $TITLE 标题
- * @property string $DESCRIPTION 描述
- * @property string $FIELD 标题英文字段
- * @property string $DEC_LEVEL 报单级别
- * @property string $EMP_LEVEL 聘级
- * @property string $CONTENT 模板内容
- * @property int $CREATED_AT 创建时间
- */
-class SmsTemplate extends \common\components\ActiveRecord
-{
-    /**
-     * @inheritdoc
-     */
-    public static function tableName()
-    {
-        return '{{%SMS_TEMPLATE}}';
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function rules()
-    {
-        return [
-            [['TITLE', 'DESCRIPTION', 'FIELD', 'CONTENT', 'CREATED_AT'], 'required'],
-            [['CREATED_AT'], 'integer'],
-            [['ID', 'TITLE', 'DEC_LEVEL', 'EMP_LEVEL'], 'string', 'max' => 32],
-            [['DESCRIPTION', 'FIELD', 'CONTENT'], 'string', 'max' => 255],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'TITLE' => '标题',
-            'DESCRIPTION' => '描述',
-            'FIELD' => '标题英文字段',
-            'DEC_LEVEL' => '报单级别',
-            'EMP_LEVEL' => '聘级',
-            'CONTENT' => '模板内容',
-            'CREATED_AT' => '创建时间',
-        ];
-    }
-
-    /**
-     * 通过报单级别的索引来获取短信模板
-     * @return array
-     */
-    public static function getTemplateByDecLevel(){
-        $allDecLevelData = static::find()->select('DEC_LEVEL')->where('DEC_LEVEL IS NOT NULL')->asArray()->groupBy('DEC_LEVEL')->all();
-        $result = [];
-        foreach($allDecLevelData as $levelData){
-            $result[$levelData['DEC_LEVEL']] = [];
-        }
-        $allData = static::find()->where('DEC_LEVEL IS NOT NULL')->asArray()->all();
-        foreach ($allData as $data){
-            if(isset($result[$data['DEC_LEVEL']])){
-                $result[$data['DEC_LEVEL']][$data['FIELD']] = $data;
-            }
-        }
-        return $result;
-    }
-
-    /**
-     * 通过聘级的索引来获取短信模板
-     * @return array
-     */
-    public static function getTemplateByEmpLevel(){
-        $allEmpLevelData = static::find()->select('EMP_LEVEL')->where('EMP_LEVEL IS NOT NULL')->asArray()->groupBy('EMP_LEVEL')->all();
-        $result = [];
-        foreach($allEmpLevelData as $levelData){
-            $result[$levelData['EMP_LEVEL']] = [];
-        }
-        $allData = static::find()->where('EMP_LEVEL IS NOT NULL')->asArray()->all();
-        foreach ($allData as $data){
-            if(isset($result[$data['EMP_LEVEL']])){
-                $result[$data['EMP_LEVEL']][] = $data;
-            }
-        }
-        return $result;
-    }
-
-    /**
-     * 从缓存获取报单级别的短信模板
-     * @return array|mixed
-     */
-    public static function getDecFromCache(){
-        $data = Yii::$app->cache->get(Cache::SMS_TEMPLATE_DEC_KEY);
-        if(!$data){
-            // 获取信息
-            $data = self::getTemplateByDecLevel();
-            Yii::$app->cache->set(Cache::SMS_TEMPLATE_DEC_KEY, $data);
-        }
-        return $data;
-    }
-
-    /**
-     * 从缓存获取报单级别的短信模板
-     * @return array|mixed
-     */
-    public static function getEmpFromCache(){
-        $data = Yii::$app->cache->get(Cache::SMS_TEMPLATE_EMP_KEY);
-        if(!$data){
-            // 获取信息
-            $data = self::getTemplateByEmpLevel();
-            Yii::$app->cache->set(Cache::SMS_TEMPLATE_EMP_KEY, $data);
-        }
-        return $data;
-    }
-
-    /**
-     * 更新报单级别的短信模板
-     * @return array
-     */
-    public static function updateDecToCache(){
-        // 获取配置
-        $data = self::getTemplateByDecLevel();
-        Yii::$app->cache->set(Cache::SMS_TEMPLATE_DEC_KEY, $data);
-        return $data;
-    }
-
-    /**
-     * 更新聘级的短信模板
-     * @return array
-     */
-    public static function updateEmpToCache(){
-        // 获取配置
-        $data = self::getTemplateByEmpLevel();
-        Yii::$app->cache->set(Cache::SMS_TEMPLATE_EMP_KEY, $data);
-        return $data;
-    }
-
-}

+ 0 - 59
common/models/Test.php

@@ -1,59 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%TEST}}".
- *
- * @property string $ID
- * @property string $USER_ID 会员ID
- * @property string $PV_PERSON_LS 个人零售隐藏分区
- * @property string $PV_PCS_ZC 个人消费注册单业绩
- * @property int $PERIOD_NUM 期数
- * @property int $CALC_MONTH 结算月
- * @property string $P_DAY 分区表划分
- * @property int $CREATED_AT 创建时间
- */
-class Test extends \common\components\ActiveRecord
-{
-    /**
-     * @inheritdoc
-     */
-    public static function tableName()
-    {
-        return '{{%TEST}}';
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function rules()
-    {
-        return [
-            [['USER_ID', 'PERIOD_NUM', 'CALC_MONTH', 'CREATED_AT'], 'required'],
-            [['PV_PERSON_LS', 'PV_PCS_ZC'], 'number'],
-            [['PERIOD_NUM', 'CALC_MONTH', 'CREATED_AT'], 'integer'],
-            [['ID', 'USER_ID'], 'string', 'max' => 32],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_ID' => '会员ID',
-            'PV_PERSON_LS' => '个人零售隐藏分区',
-            'PV_PCS_ZC' => '个人消费注册单业绩',
-            'PERIOD_NUM' => '期数',
-            'CALC_MONTH' => '结算月',
-            'P_DAY' => '分区表划分',
-            'CREATED_AT' => '创建时间',
-        ];
-    }
-}

+ 0 - 60
common/models/TmpAreaNetwork.php

@@ -1,60 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%TMP_AREA_NETWORK}}".
- *
- * @property string $ID
- * @property string $USER_NAME 编号
- * @property string $REAL_NAME 姓名
- * @property string $PARENT_USER_NAME 上级编号
- * @property string $PARENT_REAL_NAME 上级姓名
- * @property string $NET_USER_NAME 安置人编号
- * @property string $NET_REAL_NAME 安置人姓名
- * @property int $SORT 排序
- */
-class TmpAreaNetwork extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%TMP_AREA_NETWORK}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['USER_NAME', 'REAL_NAME', 'PARENT_USER_NAME', 'PARENT_REAL_NAME', 'NET_USER_NAME', 'NET_REAL_NAME'], 'required'],
-            [['SORT'], 'integer'],
-            [['ID'], 'string', 'max' => 32],
-            [['USER_NAME', 'PARENT_USER_NAME', 'NET_USER_NAME'], 'string', 'max' => 16],
-            [['REAL_NAME', 'PARENT_REAL_NAME', 'NET_REAL_NAME'], 'string', 'max' => 128],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_NAME' => '编号',
-            'REAL_NAME' => '姓名',
-            'PARENT_USER_NAME' => '上级编号',
-            'PARENT_REAL_NAME' => '上级姓名',
-            'NET_USER_NAME' => '安置人编号',
-            'NET_REAL_NAME' => '安置人姓名',
-            'SORT' => '排序',
-        ];
-    }
-}

+ 0 - 52
common/models/TmpDeleteUser.php

@@ -1,52 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%TMP_DELETE_USER}}".
- *
- * @property string $ID
- * @property string $USER_ID 会员ID
- * @property string $USER_NAME 编号
- * @property string $REAL_NAME 名称
- *
- */
-class TmpDeleteUser extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%TMP_DELETE_USER}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['USER_ID', 'USER_NAME', 'REAL_NAME'], 'required'],
-            [['ID','USER_ID'], 'string', 'max' => 32],
-            [['USER_NAME'], 'string', 'max' => 16],
-            [['REAL_NAME'], 'string', 'max' => 128],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_ID' => 'ID',
-            'USER_NAME' => '编号',
-            'REAL_NAME' => '名称',
-        ];
-    }
-}

+ 0 - 47
common/models/TmpFreezeUser.php

@@ -1,47 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%TMP_FREEZE_USER}}".
- *
- * @property string $ID
- * @property string $USER_NAME 编号
- * @property string $REAL_NAME 名称
- */
-class TmpFreezeUser extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%TMP_FREEZE_USER}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['USER_NAME', 'REAL_NAME'], 'required'],
-            [['ID'], 'string', 'max' => 32],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_NAME' => '编号',
-            'REAL_NAME' => '名称',
-        ];
-    }
-}

+ 0 - 60
common/models/TmpOldNetwork.php

@@ -1,60 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%TMP_OLD_NETWORK}}".
- *
- * @property string $ID
- * @property string $USER_NAME 编号
- * @property string $REAL_NAME 姓名
- * @property string $PARENT_USER_NAME 上级编号
- * @property string $PARENT_REAL_NAME 上级姓名
- * @property string $NET_USER_NAME 安置人编号
- * @property string $NET_REAL_NAME 安置人姓名
- * @property int $SORT 排序
- */
-class TmpOldNetwork extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%TMP_OLD_NETWORK}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['USER_NAME', 'REAL_NAME', 'PARENT_USER_NAME', 'PARENT_REAL_NAME', 'NET_USER_NAME', 'NET_REAL_NAME'], 'required'],
-            [['SORT'], 'integer'],
-            [['ID'], 'string', 'max' => 32],
-            [['USER_NAME', 'PARENT_USER_NAME', 'NET_USER_NAME'], 'string', 'max' => 16],
-            [['REAL_NAME', 'PARENT_REAL_NAME', 'NET_REAL_NAME'], 'string', 'max' => 128],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_NAME' => '编号',
-            'REAL_NAME' => '姓名',
-            'PARENT_USER_NAME' => '上级编号',
-            'PARENT_REAL_NAME' => '上级姓名',
-            'NET_USER_NAME' => '安置人编号',
-            'NET_REAL_NAME' => '安置人姓名',
-            'SORT' => '排序',
-        ];
-    }
-}

+ 0 - 64
common/models/TmpOldNetworkAll.php

@@ -1,64 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%TMP_OLD_NETWORK_ALL}}".
- *
- * @property string $ID
- * @property string $USER_NAME 编号
- * @property string $REAL_NAME 姓名
- * @property string $PARENT_USER_NAME 上级编号
- * @property string $PARENT_REAL_NAME 上级姓名
- * @property string $NET_USER_NAME 安置人编号
- * @property string $NET_REAL_NAME 安置人姓名
- * @property int $SORT 排序
- * @property int $NET_DEEP 安置深度
- * @property int $REC_DEEP 推荐深度
- */
-class TmpOldNetworkAll extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%TMP_OLD_NETWORK_ALL}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['USER_NAME', 'REAL_NAME', 'PARENT_USER_NAME', 'PARENT_REAL_NAME', 'NET_USER_NAME', 'NET_REAL_NAME'], 'required'],
-            [['SORT','NET_DEEP','REC_DEEP'], 'integer'],
-            [['ID'], 'string', 'max' => 32],
-            [['USER_NAME', 'PARENT_USER_NAME', 'NET_USER_NAME'], 'string', 'max' => 16],
-            [['REAL_NAME', 'PARENT_REAL_NAME', 'NET_REAL_NAME'], 'string', 'max' => 128],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_NAME' => '编号',
-            'REAL_NAME' => '姓名',
-            'PARENT_USER_NAME' => '上级编号',
-            'PARENT_REAL_NAME' => '上级姓名',
-            'NET_USER_NAME' => '安置人编号',
-            'NET_REAL_NAME' => '安置人姓名',
-            'SORT' => '排序',
-            'NET_DEEP' => '安置深度',
-            'REC_DEEP' => '推荐深度',
-        ];
-    }
-}

+ 0 - 64
common/models/TmpOldNetworkError.php

@@ -1,64 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%TMP_OLD_NETWORK_ERROR}}".
- *
- * @property string $ID
- * @property string $USER_NAME 编号
- * @property string $REAL_NAME 姓名
- * @property string $PARENT_USER_NAME 上级编号
- * @property string $PARENT_REAL_NAME 上级姓名
- * @property string $NET_USER_NAME 安置人编号
- * @property string $NET_REAL_NAME 安置人姓名
- * @property int $SORT 排序
- * @property int $NET_DEEP 安置深度
- * @property int $REC_DEEP 推荐深度
- */
-class TmpOldNetworkError extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%TMP_OLD_NETWORK_ERROR}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['USER_NAME', 'REAL_NAME', 'PARENT_USER_NAME', 'PARENT_REAL_NAME', 'NET_USER_NAME', 'NET_REAL_NAME'], 'required'],
-            [['SORT','NET_DEEP','REC_DEEP'], 'integer'],
-            [['ID'], 'string', 'max' => 32],
-            [['USER_NAME', 'PARENT_USER_NAME', 'NET_USER_NAME'], 'string', 'max' => 16],
-            [['REAL_NAME', 'PARENT_REAL_NAME', 'NET_REAL_NAME'], 'string', 'max' => 128],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_NAME' => '编号',
-            'REAL_NAME' => '姓名',
-            'PARENT_USER_NAME' => '上级编号',
-            'PARENT_REAL_NAME' => '上级姓名',
-            'NET_USER_NAME' => '安置人编号',
-            'NET_REAL_NAME' => '安置人姓名',
-            'SORT' => '排序',
-            'NET_DEEP' => '安置深度',
-            'REC_DEEP' => '推荐深度',
-        ];
-    }
-}

+ 0 - 64
common/models/TmpOldNetworkReplenish.php

@@ -1,64 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%TMP_OLD_NETWORK_REPLENISH}}".
- *
- * @property string $ID
- * @property string $USER_NAME 编号
- * @property string $REAL_NAME 姓名
- * @property string $PARENT_USER_NAME 上级编号
- * @property string $PARENT_REAL_NAME 上级姓名
- * @property string $NET_USER_NAME 安置人编号
- * @property string $NET_REAL_NAME 安置人姓名
- * @property int $SORT 排序
- * @property int $NET_DEEP 安置深度
- * @property int $REC_DEEP 推荐深度
- */
-class TmpOldNetworkReplenish extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%TMP_OLD_NETWORK_REPLENISH}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['USER_NAME', 'REAL_NAME', 'PARENT_USER_NAME', 'PARENT_REAL_NAME', 'NET_USER_NAME', 'NET_REAL_NAME'], 'required'],
-            [['SORT','NET_DEEP','REC_DEEP'], 'integer'],
-            [['ID'], 'string', 'max' => 32],
-            [['USER_NAME', 'PARENT_USER_NAME', 'NET_USER_NAME'], 'string', 'max' => 16],
-            [['REAL_NAME', 'PARENT_REAL_NAME', 'NET_REAL_NAME'], 'string', 'max' => 128],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_NAME' => '编号',
-            'REAL_NAME' => '姓名',
-            'PARENT_USER_NAME' => '上级编号',
-            'PARENT_REAL_NAME' => '上级姓名',
-            'NET_USER_NAME' => '安置人编号',
-            'NET_REAL_NAME' => '安置人姓名',
-            'SORT' => '排序',
-            'NET_DEEP' => '安置深度',
-            'REC_DEEP' => '推荐深度',
-        ];
-    }
-}

+ 0 - 60
common/models/TmpOldUser.php

@@ -1,60 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%TMP_OLD_USER}}".
- *
- * @property string $ID
- * @property string $USER_NAME 编号
- * @property string $REAL_NAME 名称
- * @property string $REC_USER_NAME 推荐人编号
- * @property string $REC_REAL_NAME 推荐人姓名
- * @property string $NET_USER_NAME 安置人编号
- * @property string $NET_REAL_NAME 安置人姓名
- * @property int $SORT 排序
- */
-class TmpOldUser extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%TMP_OLD_USER}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['USER_NAME', 'REAL_NAME', 'REC_USER_NAME', 'REC_REAL_NAME', 'NET_USER_NAME', 'NET_REAL_NAME'], 'required'],
-            [['SORT'], 'integer'],
-            [['ID'], 'string', 'max' => 32],
-            [['USER_NAME', 'REC_USER_NAME', 'NET_USER_NAME'], 'string', 'max' => 16],
-            [['REAL_NAME', 'REC_REAL_NAME', 'NET_REAL_NAME'], 'string', 'max' => 128],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_NAME' => '编号',
-            'REAL_NAME' => '名称',
-            'REC_USER_NAME' => '推荐人编号',
-            'REC_REAL_NAME' => '推荐人姓名',
-            'NET_USER_NAME' => '安置人编号',
-            'NET_REAL_NAME' => '安置人姓名',
-            'SORT' => '排序',
-        ];
-    }
-}

+ 0 - 144
common/models/Transfer.php

@@ -1,144 +0,0 @@
-<?php
-
-namespace common\models;
-
-use common\helpers\Tool;
-use Yii;
-
-/**
- * This is the model class for table "{{%TRANSFER}}".
- *
- * @property string $ID
- * @property string $TRANSFER_SN 转账记录流水号
- * @property string $OUT_UID 转出会员ID
- * @property string $LAST_OUT_USER_NAME 转账时转出会员编号
- * @property string $LAST_OUT_REAL_NAME 转账时转出会员姓名
- * @property string $LAST_OUT_DEC_LV 转账时转出会员级别
- * @property string $LAST_OUT_DEC_ROLE_ID 转账时转出会员报单中心级别
- * @property string $OUT_WALLET 转出账户
- * @property string $LAST_OUT_SYSTEM_ID 转账时转出会员体系
- * @property string $IN_UID 转入会员ID
- * @property string $LAST_IN_USER_NAME 转账时转入会员编号
- * @property string $LAST_IN_REAL_NAME 转账时转入会员姓名
- * @property string $LAST_IN_DEC_LV 转账时转入会员级别
- * @property string $IN_WALLET 转入账户
- * @property string $LAST_IN_SYSTEM_ID 转账时转入会员体系
- * @property string $ORI_AMOUNT 转账金额
- * @property string $FEE 手续费
- * @property string $AMOUNT 实际转入金额
- * @property string $REMARK 备注
- * @property int $PERIOD_NUM 所在期数
- * @property int $CALC_MONTH 所在结算月
- * @property int $CREATED_AT 创建时间
- */
-class Transfer extends \common\components\ActiveRecord
-{
-
-    const WALLET_NAME = [
-        'bonus'=>'奖金',
-        'cash'=>'余额',
-    ];
-
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%TRANSFER}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['TRANSFER_SN', 'OUT_UID', 'LAST_OUT_USER_NAME', 'LAST_OUT_REAL_NAME', 'IN_UID', 'LAST_IN_USER_NAME', 'LAST_IN_REAL_NAME', 'PERIOD_NUM', 'CALC_MONTH', 'CREATED_AT'], 'required'],
-            [['ORI_AMOUNT', 'FEE', 'AMOUNT'], 'number'],
-            [['PERIOD_NUM', 'CALC_MONTH', 'CREATED_AT'], 'integer'],
-            [['ID', 'TRANSFER_SN', 'OUT_UID', 'LAST_OUT_DEC_LV', 'LAST_OUT_DEC_ROLE_ID', 'LAST_OUT_SYSTEM_ID', 'IN_UID', 'LAST_IN_DEC_LV', 'LAST_IN_SYSTEM_ID'], 'string', 'max' => 32],
-            [['LAST_OUT_USER_NAME', 'LAST_IN_USER_NAME'], 'string', 'max' => 16],
-            [['LAST_OUT_REAL_NAME', 'OUT_WALLET', 'LAST_IN_REAL_NAME', 'IN_WALLET'], 'string', 'max' => 128],
-            [['REMARK'], 'string', 'max' => 4000],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'TRANSFER_SN' => '转账记录流水号',
-            'OUT_UID' => '转出会员ID',
-            'LAST_OUT_USER_NAME' => '转账时转出会员编号',
-            'LAST_OUT_REAL_NAME' => '转账时转出会员姓名',
-            'LAST_OUT_DEC_LV' => '转账时转出会员级别',
-            'LAST_OUT_DEC_ROLE_ID' => '转账时转出会员报单中心级别',
-            'OUT_WALLET' => '转出账户',
-            'LAST_OUT_SYSTEM_ID' => '转账时转出会员体系',
-            'IN_UID' => '转入会员ID',
-            'LAST_IN_USER_NAME' => '转账时转入会员编号',
-            'LAST_IN_REAL_NAME' => '转账时转入会员姓名',
-            'LAST_IN_DEC_LV' => '转账时转入会员级别',
-            'IN_WALLET' => '转入账户',
-            'LAST_IN_SYSTEM_ID' => '转账时转入会员体系',
-            'ORI_AMOUNT' => '转账金额',
-            'FEE' => '手续费',
-            'AMOUNT' => '实际转入金额',
-            'REMARK' => '备注',
-            'PERIOD_NUM' => '所在期数',
-            'CALC_MONTH' => '所在结算月',
-            'CREATED_AT' => '创建时间',
-        ];
-    }
-
-    /**
-     * 生成sn
-     * @return string
-     */
-    public static function generateSN() {
-        $date = date('ymdHis');
-        $sn = 'BZZ' . $date . Tool::numFix(rand(1, 9999999999), 10, '0');
-        if (self::find()->where('TRANSFER_SN=:SN', [':SN' => $sn])->exists()) {
-            return self::generateSN();
-        }
-        return $sn;
-    }
-
-    /**
-     * 本周是否转账
-     * @param $uid
-     * @return bool
-     */
-    public static function hasThisWeekTransfer($uid) {
-        $period = Period::instance();
-        if (static::find()->where('OUT_UID=:OUT_UID AND PERIOD_NUM=:PERIOD_NUM', [':OUT_UID' => $uid, ':PERIOD_NUM' => $period->getNowPeriodNum()])->exists()) {
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * 本周提现总额
-     * @param $uid
-     * @return mixed
-     */
-    public static function weekTransfer($uid){
-        $period = Period::instance();
-        return static::find()->where('OUT_UID=:OUT_UID AND PERIOD_NUM=:PERIOD_NUM', [':OUT_UID' => $uid, ':PERIOD_NUM' => $period->getNowPeriodNum()])->sum('ORI_AMOUNT');
-    }
-
-    /**
-     * 本月提现总额
-     * @param $uid
-     * @return mixed
-     */
-    public static function monthTransfer($uid){
-        $period = Period::instance();
-        return static::find()->where('OUT_UID=:OUT_UID AND CALC_MONTH=:CALC_MONTH', [':OUT_UID' => $uid, ':CALC_MONTH' => $period->getNowYearMonth()])->sum('ORI_AMOUNT');
-    }
-
-}

+ 0 - 66
common/models/Uploads.php

@@ -1,66 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%UPLOADS}}".
- *
- * @property string $ID
- * @property string $FILE_NAME 文件名称
- * @property string $CATEGORY 分类
- * @property string $REMARK 备注
- * @property string $URL 文件路径
- * @property string $FILE_SIZE 文件大小
- * @property string $MD5 MD5值
- * @property int $CREATED_AT 创建时间
- */
-class Uploads extends \common\components\ActiveRecord
-{
-    const CATEGORY_ID_CARD = 'idCard';
-    const CATEGORY_INVOICE = 'invoice';
-    const CATEGORY_IMAGE = 'image';
-    const CATEGORY_EXCEL = 'excel';
-    const CATEGORY_UN_KNOW = 'unKnow';
-
-    /**
-     * @inheritdoc
-     */
-    public static function tableName()
-    {
-        return '{{%UPLOADS}}';
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function rules()
-    {
-        return [
-            [['FILE_NAME', 'CATEGORY', 'URL', 'CREATED_AT'], 'required'],
-            [['CREATED_AT'], 'integer'],
-            [['ID', 'MD5'], 'string', 'max' => 32],
-            [['FILE_NAME', 'CATEGORY', 'REMARK', 'FILE_SIZE'], 'string', 'max' => 255],
-            [['URL'], 'string', 'max' => 1000],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'FILE_NAME' => '文件名称',
-            'CATEGORY' => '分类',
-            'REMARK' => '备注',
-            'URL' => '文件路径',
-            'FILE_SIZE' => '文件大小',
-            'MD5' => 'MD5值',
-            'CREATED_AT' => '创建时间',
-        ];
-    }
-}

+ 0 - 320
common/models/UserBind.php

@@ -1,320 +0,0 @@
-<?php
-
-namespace common\models;
-
-use backendApi\modules\v1\models\Admin;
-use common\helpers\Date;
-use common\helpers\Form;
-use common\helpers\user\Info;
-use common\helpers\user\Status;
-use common\models\forms\UserBindForm;
-use Yii;
-use yii\base\Exception;
-use common\libs\logging\operate\valueType\Config as ValueTypeConfig;
-
-/**
- * This is the model class for table "{{%USER_BIND}}".
- *
- * @property string $ID
- * @property string $USER_ID 会员ID
- * @property string $MAIN_UID 主会员ID
- * @property int $PERIOD_NUM 加入时期数
- * @property int $IS_DEL 是否删除
- * @property int $CREATED_AT 创建时间
- * @property int $UPDATED_AT 修改时间
- * @property string $CREATE_ADMIN 创建管理员
- * @property string $CREATE_USER 创建会员
- * @property string $UPDATE_ADMIN 修改管理员
- * @property string $UPDATE_USER 修改会员
- * @property int $DELETED_AT 已删除
- */
-class UserBind extends \common\components\ActiveRecord {
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName() {
-        return '{{%USER_BIND}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules() {
-        return [
-            [['USER_ID', 'MAIN_UID', 'PERIOD_NUM', 'CREATED_AT'], 'required'],
-            [['PERIOD_NUM', 'IS_DEL', 'CREATED_AT', 'UPDATED_AT', 'DELETED_AT'], 'integer'],
-            [['ID', 'USER_ID', 'MAIN_UID', 'CREATE_ADMIN', 'CREATE_USER', 'UPDATE_ADMIN', 'UPDATE_USER'], 'string', 'max' => 32],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels() {
-        return [
-            'ID' => 'ID',
-            'USER_ID' => '会员ID',
-            'MAIN_UID' => '主会员ID',
-            'PERIOD_NUM' => '加入时期数',
-            'IS_DEL' => '是否删除',
-            'CREATE_ADMIN' => '创建管理员',
-            'CREATE_USER' => '创建会员',
-            'UPDATE_ADMIN' => '修改管理员',
-            'UPDATE_USER' => '修改会员',
-            'CREATED_AT' => '创建时间',
-            'UPDATED_AT' => '修改时间',
-            'DELETED_AT' => '已删除',
-        ];
-    }
-
-    /**
-     * @return \yii\db\ActiveQuery
-     */
-    public function getUser() {
-        return $this->hasOne(User::className(), ['ID' => 'USER_ID']);
-    }
-
-    /**
-     * 为删除的会员点位体系设置新的主会员
-     * @param $userId
-     */
-    public static function setNewBindWhenUserDel($userId) {
-        //如果是主点位
-        if (self::find()->where('USER_ID=:MAIN_UID AND MAIN_UID=:MAIN_UID AND IS_DEL=0', [':MAIN_UID' => $userId])->orderBy('CREATED_AT ASC')->asArray()->one()) {
-            self::setNewMainBind($userId);
-        }
-        self::updateAll(['IS_DEL' => 1, 'DELETED_AT' => Date::nowTime()], 'USER_ID=:USER_ID', [':USER_ID' => $userId]);
-    }
-
-    /**
-     * 向下找新的会员成为新的主会员,优先找不以hz开头的会员
-     * @param $userId
-     * @param null $idCard
-     * @return bool
-     * @throws \Exception
-     */
-    public static function setNewMainBind($userId,$idCard=null) {
-        //是否是主会员
-        if (!self::find()->where('USER_ID=:USER_ID AND MAIN_UID=:USER_ID AND IS_DEL=0', [':USER_ID' => $userId])->exists()) {
-            return false;
-        }
-        //取同一身份证的最近会员
-        if(!$idCard) $idCard = Info::getIdCardByUserId($userId);
-        //把所有实名身份证的会员绑到一起
-        $hasUsers = User::findAllAsArray('ID_CARD=:ID_CARD AND VERIFIED=1 AND STATUS=1 AND DELETED=0',[':ID_CARD'=>$idCard],'ID');
-        if($hasUsers){
-            $period = Period::instance();
-            $periodNum = $period->getNowPeriodNum();
-            foreach ($hasUsers as $u){
-                if(!self::find()->where('USER_ID=:USER_ID AND IS_DEL=0',[':USER_ID'=>$u['ID']])->exists()){
-                    UserInfo::updateAll(['IS_BIND' => 1], 'USER_ID=:USER_ID', [':USER_ID' => $u['ID']]);
-                    // 添加会员合作点位
-                    $model = new UserBind();
-                    $model->USER_ID = $u['ID'];
-                    $model->MAIN_UID = $userId;
-                    $model->PERIOD_NUM = $periodNum;
-                    $model->IS_DEL = 0;
-                    $model->CREATE_ADMIN = \Yii::$app->user->id??'';
-                    $model->CREATED_AT = Date::nowTime();
-                    if (!$model->save()) {
-                        throw new \Exception($model->getErrors());
-                    }
-                }
-            }
-        }
-        $newMainUid = 0;
-        if ($newMain = User::find()->select('ID')->where("ID!=:ID AND ID_CARD=:ID_CARD AND IS_UNION=0 AND VERIFIED=1 AND STATUS=1 AND DELETED=0", [':ID'=>$userId, ':ID_CARD' => $idCard])->orderBy('CREATED_AT ASC')->asArray()->one()) {
-            $newMainUid = $newMain['ID'];
-        } else {
-            if ($newMain = User::find()->select('ID')->where("ID!=:ID AND ID_CARD=:ID_CARD AND STATUS=1 AND VERIFIED=1 AND DELETED=0", [':ID'=>$userId, ':ID_CARD' => $idCard])->orderBy('CREATED_AT ASC')->asArray()->one()) {
-                $newMainUid = $newMain['ID'];
-            }
-        }
-        if ($newMainUid) {
-            //设置主会员
-            UserInfo::updateAll(['IS_BIND_MAIN' => 1], 'USER_ID=:USER_ID', [':USER_ID' => $newMainUid]);
-            //更新绑定表的主会员
-            self::updateAll(['MAIN_UID' => $newMainUid,'UPDATED_AT'=>Date::nowTime()], 'MAIN_UID=:MAIN_UID AND IS_DEL=0', [':MAIN_UID' => $userId]);
-            //取消原来主会员
-            UserInfo::updateAll(['IS_BIND_MAIN' => 0], 'USER_ID=:USER_ID', [':USER_ID' => $userId]);
-        }
-    }
-
-    /**
-     * 商城报首购单,rpc中绑定
-     * @param $userIds
-     * @param $idCard
-     * @throws Exception
-     * @throws \yii\db\Exception
-     */
-    public static function zcBind($userIds, $idCard){
-        if(!empty($userIds)){
-            // 从一批的首购会员中拿出第一个去数据库里面查找
-            // 拿身份证编号去数据库中查找看看有没有同身份证并实名认证的会员
-            $sameUsers = User::find()->select('ID')->where('ID!=:ID AND VERIFIED=1 AND ID_CARD=:ID_CARD', [':ID' => $userIds[0], ':ID_CARD' => $idCard])->orderBy('CREATED_AT ASC')->asArray()->all();
-            // 如果有
-            if($sameUsers){
-                // 把这些相同身份证号的会员追加到$userIds的数组中
-                $mainUid = $sameUsers[0]['ID'];
-                foreach ($sameUsers as $u) {
-                    //是否有绑定,有则绑定到绑定位置,无则新建绑定
-                    $hasBind = self::find()->select('MAIN_UID')->where('USER_ID=:USER_ID AND IS_DEL=0', [':USER_ID' => $u['ID']])->asArray()->one();
-                    if ($hasBind) {
-                        $mainUid = $hasBind['MAIN_UID'];
-                        break;
-                    }
-                }
-                foreach($userIds as $uid){
-                    // 是否有绑定关系没有就新增
-                    if(!self::find()->select('MAIN_UID')->where('USER_ID=:USER_ID AND IS_DEL=0', [':USER_ID' => $uid])->asArray()->exists()){
-                        $userBindForm = new UserBindForm();
-                        $userBindForm->scenario = 'autoBind';
-                        $userBindForm->userId = $uid;
-                        $userBindForm->mainUid = $mainUid;
-                        if (!$userBindForm->autoBind()) {
-                            throw new Exception('与其他同身份证会员点位绑定失败'.Form::formatErrorsForApi($userBindForm->getErrors()));
-                        }
-                    }
-                }
-            }
-            // 如果没有
-            else {
-                // 只有当新注册的会员数量大于一个才需要绑定
-                if(count($userIds) > 1){
-                    $mainUid = $userIds[0];
-                    unset($userIds[0]);
-                    // 把这些人都循环绑定到一起
-                    foreach($userIds as $uid){
-                        $userBindForm = new UserBindForm();
-                        $userBindForm->scenario = 'autoBind';
-                        $userBindForm->userId = $uid;
-                        $userBindForm->mainUid = $mainUid;
-                        if (!$userBindForm->autoBind()) {
-                            throw new Exception('点位绑定失败'.Form::formatErrorsForApi($userBindForm->getErrors()));
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    /**
-     * 自动绑定
-     * @param $userId
-     * @param null $idCard
-     * @param int $verified
-     * @return bool|string
-     * @throws \yii\db\Exception
-     */
-    public static function autoBind($userId,$idCard=null,$verified=1) {
-        if($verified==0){
-            if (self::find()->where('USER_ID=:MAIN_UID AND MAIN_UID=:MAIN_UID AND IS_DEL=0',[':MAIN_UID'=>$userId])->exists()) {
-                self::setNewMainBind($userId);
-            }
-            UserInfo::updateAll(['IS_BIND' => 0], 'USER_ID=:USER_ID', [':USER_ID' => $userId]);
-            self::updateAll(['IS_DEL' => 1, 'DELETED_AT' => Date::nowTime()], 'USER_ID=:USER_ID', [':USER_ID' => $userId]);
-            return '取消绑定关系成功';
-        }else {
-            if (self::find()->where('USER_ID=:MAIN_UID AND MAIN_UID=:MAIN_UID AND IS_DEL=0',[':MAIN_UID'=>$userId])->exists()) {
-                return '此会员是主会员,绑定关系未改变';
-            }
-            //清除原有绑定关系
-            self::updateAll(['IS_DEL' => 1, 'DELETED_AT' => Date::nowTime()], 'USER_ID=:USER_ID', [':USER_ID' => $userId]);
-            UserInfo::updateAll(['IS_BIND' => 0, 'IS_BIND_MAIN' => 0], 'USER_ID=:USER_ID', [':USER_ID' => $userId]);
-            //获取新的绑定关系
-            if (!$idCard) {
-                $idCard = Info::getIdCardByUserId($userId);
-            }
-            $hasUsers = User::find()->select('ID')->where('ID!=:ID AND VERIFIED=1 AND ID_CARD=:ID_CARD', [':ID' => $userId, ':ID_CARD' => $idCard])->orderBy('CREATED_AT ASC')->asArray()->all();
-            //如果有同一身份证的其他点位
-            if ($hasUsers) {
-                $mainUid = $hasUsers[0]['ID'];
-                foreach ($hasUsers as $u) {
-                    //是否有绑定,有则绑定到绑定位置,无则新建绑定
-                    $hasBind = self::find()->select('MAIN_UID')->where('USER_ID=:USER_ID AND IS_DEL=0 AND MAIN_UID!=:MAIN_UID', [':USER_ID' => $u['ID'], ':MAIN_UID' => $userId])->asArray()->one();
-                    if ($hasBind) {
-                        $mainUid = $hasBind['MAIN_UID'];
-                        break;
-                    }
-                }
-                $userBindForm = new UserBindForm();
-                $userBindForm->scenario = 'autoBind';
-                $userBindForm->userId = $userId;
-                $userBindForm->mainUid = $mainUid;
-                if ($result = $userBindForm->autoBind()) {
-                    return '实名验证成功,此会员编号为非主会员编号,不可提现,可以转账';
-                } else {
-                    return false;
-                }
-            } else {
-                /*$userBindForm = new UserBindForm();
-                $userBindForm->scenario = 'autoBind';
-                $userBindForm->userId = $userId;
-                $userBindForm->mainUid = $userId;
-                if ($result = $userBindForm->autoBind()) {
-                    return '实名验证成功';
-                } else {
-                    return false;
-                }*/
-                return '实名验证成功';
-            }
-        }
-    }
-
-    /**
-     * 是否绑定在一起
-     * @param $oneId
-     * @param $twoId
-     * @return bool
-     */
-    public static function sameBind($oneId, $twoId) {
-        $oneBind = self::findOneAsArray('USER_ID=:USER_ID AND IS_DEL=0', [':USER_ID' => $oneId], 'MAIN_UID');
-        $twoBind = self::findOneAsArray('USER_ID=:USER_ID AND IS_DEL=0', [':USER_ID' => $twoId], 'MAIN_UID');
-        if ($oneBind && $twoBind && $oneBind['MAIN_UID'] == $twoBind['MAIN_UID']) {
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * 操作日志记录条件
-     * @return array
-     */
-    public function attrLabelsWithLogType(){
-        return [
-            'USER_ID' => '会员ID',
-            'MAIN_UID' => [
-                'label' => '主会员编号',
-                'type' => function($data){
-                    $value = $data['value'];
-                    return Info::getUserNameByUserId($value);
-                },
-            ],
-            'CREATE_ADMIN' => [
-                'label' => '创建管理员',
-                'type' => function($data){
-                    $value = $data['value'];
-                    $result = Admin::findOneAsArray('ID=:ID', [':ID'=>$value], 'ADMIN_NAME');
-                    return $result['ADMIN_NAME'];
-                },
-            ],
-            'UPDATE_ADMIN' => [
-                'label' => '修改管理员',
-                'type' => function($data){
-                    $value = $data['value'];
-                    $result = Admin::findOneAsArray('ID=:ID', [':ID'=>$value], 'ADMIN_NAME');
-                    return $result['ADMIN_NAME'];
-                },
-            ],
-            'CREATED_AT' => [
-                'label' => '创建时间',
-                'type' => ValueTypeConfig::DATE_TIME_TYPE,
-            ],
-            'UPDATED_AT' => [
-                'label' => '修改时间',
-                'type' => ValueTypeConfig::DATE_TIME_TYPE,
-            ],
-        ];
-    }
-}

+ 0 - 165
common/models/UserBonus.php

@@ -1,165 +0,0 @@
-<?php
-
-namespace common\models;
-
-use common\helpers\user\Info;
-use Yii;
-use common\libs\logging\operate\valueType\Config as ValueTypeConfig;
-
-/**
- * This is the model class for table "{{%USER_BONUS}}".
- *
- * @property string $ID
- * @property string $USER_ID 会员ID
- * @property string $BONUS 奖金总额
- * @property string $BONUS_FREEZE 奖金冻结部分
- * @property string $CF 车房养老奖
- * @property string $LX 领袖分红奖
- * @property string $QY_TOTAL 区域津贴累计
- * @property string $YC_TOTAL 育成津贴累计
- * @property string $VIP_TOTAL VIP奖金累计
- * @property string $FX_TOTAL 复销奖累计
- * @property string $LS_TOTAL 零售奖累计
- * @property string $FW_TOTAL 区级店业绩提成累计
- * @property string $BT_TOTAL 店补累计
- * @property string $BT_PROD_TOTAL 产品补贴累计
- * @property string $BT_TOOL_TOTAL 工具流补贴累计
- * @property string $CF_TOTAL 车房养老奖累计
- * @property string $LX_TOTAL 领袖分红累计
- * @property string $DEDUCT_ZR_TOTAL 责任业绩扣除累计
- * @property string $FL_TOTAL 形象店货补累计
- * @property int $VER 乐观锁标识
- * @property int $CREATED_AT 创建时间
- * @property int $BD_TOTAL 服务奖累计
- * @property int $TG_TOTAL 推广奖累计
- * @property int $YJ_TOTAL 业绩奖累计
- * @property int $GX_TOTAL 共享奖累计
- * @property int $GL_TOTAL 管理奖累计
- * @property int $ORI_QY_TOTAL 团队奖原奖金累计
- * @property int $ORI_YC_TOTAL 荣衔奖原奖金累计
- * @property int $ORI_VIP_TOTAL VIP奖原奖金累计
- * @property int $ORI_BD_TOTAL 服务奖原奖金累计
- * @property int $ORI_TG_TOTAL 推广奖原奖金累计
- * @property int $ORI_YJ_TOTAL 业绩奖原奖金累计
- * @property int $ORI_GX_TOTAL 共享奖原奖金累计
- * @property int $ORI_GL_TOTAL 管理奖原奖金累计
- * @property int $RECONSUME_POINTS 复消积分
- * @property int $RECONSUME_POINTS_EXPIRED 复消积分过期
- * @property int $RECONSUME_POINTS_TOTAL 复消积分累计
- * @property int $MANAGE_TAX 管理费累计
- * @property int $BONUS_TOTAL 总奖金累计
- */
-class UserBonus extends \common\components\ActiveRecord
-{
-    const TYPE = BalanceAudit::TYPE;
-
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%USER_BONUS}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['USER_ID', 'CREATED_AT'], 'required'],
-            [['BONUS', 'BONUS_FREEZE', 'CF', 'LX', 'QY_TOTAL', 'YC_TOTAL', 'VIP_TOTAL', 'FX_TOTAL', 'LS_TOTAL', 'FW_TOTAL', 'BT_TOTAL', 'BT_PROD_TOTAL', 'BT_TOOL_TOTAL', 'CF_TOTAL', 'LX_TOTAL', 'DEDUCT_ZR_TOTAL', 'FL_TOTAL', 'BD_TOTAL','TG_TOTAL','YJ_TOTAL','GX_TOTAL','GL_TOTAL', 'ORI_QY_TOTAL','ORI_YC_TOTAL','ORI_YC_TOTAL','ORI_BD_TOTAL','ORI_TG_TOTAL','ORI_YJ_TOTAL','ORI_GX_TOTAL','ORI_GL_TOTAL','RECONSUME_POINTS','MANAGE_TAX', 'RECONSUME_POINTS_EXPIRED', 'RECONSUME_POINTS_TOTAL', 'BONUS_TOTAL'], 'number'],
-            [['VER', 'CREATED_AT'], 'integer'],
-            [['ID','USER_ID'], 'string', 'max' => 32],
-            [['USER_ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_ID' => '会员ID',
-            'BONUS' => '奖金总额',
-            'BONUS_FREEZE' => '奖金冻结部分',
-            'CF' => '车房养老奖',
-            'LX' => '领袖分红奖',
-            'QY_TOTAL' => '区域津贴累计',
-            'YC_TOTAL' => '育成津贴累计',
-            'VIP_TOTAL' => 'VIP奖金累计',
-            'FX_TOTAL' => '复销奖累计',
-            'LS_TOTAL' => '零售奖累计',
-            'FW_TOTAL' => '服务奖累计',
-            'BT_TOTAL' => '店补累计',
-            'BT_PROD_TOTAL' => '产品补贴累计',
-            'BT_TOOL_TOTAL' => '工具流补贴累计',
-            'CF_TOTAL' => '车房养老奖累计',
-            'LX_TOTAL' => '领袖分红累计',
-            'DEDUCT_ZR_TOTAL' => '责任业绩扣除累计',
-            'FL_TOTAL' => '形象店货补累计',
-            'VER' => '乐观锁标识',
-            'CREATED_AT' => '创建时间',
-            'BD_TOTAL'=> '服务奖累计',
-            'TG_TOTAL'=> '推广奖累计',
-            'YJ_TOTAL'=> '业绩奖累计',
-            'GX_TOTAL'=> '共享奖累计',
-            'GL_TOTAL'=> '管理奖累计',
-            'ORI_QY_TOTAL' => '团队奖原奖金累计',
-            'ORI_YC_TOTAL' => '荣衔奖原奖金累计',
-            'ORI_VIP_TOTAL' => 'VIP奖原奖金累计',
-            'ORI_BD_TOTAL' => '服务奖原奖金累计',
-            'ORI_TG_TOTAL' => '推广奖原奖金累计',
-            'ORI_YJ_TOTAL' => '业绩奖原奖金累计',
-            'ORI_GX_TOTAL' => '共享奖原奖金累计',
-            'ORI_GL_TOTAL' => '管理奖原奖金累计',
-            'RECONSUME_POINTS' => '复消积分',
-            'RECONSUME_POINTS_TOTAL' => '复消积分累计',
-            'RECONSUME_POINTS_EXPIRED' => '复消积分过期',
-            'MANAGE_TAX' => '管理费累计',
-            'BONUS_TOTAL' => '总奖金累计',
-        ];
-    }
-
-    /**
-     * 操作日志记录条件
-     * @return array
-     */
-    public function attrLabelsWithLogType(){
-        return [
-            'USER_ID' => '会员ID',
-            'BONUS' => '会员账户',
-            'CF' => '车房养老奖',
-            'LX' => '领袖分红奖',
-        ];
-    }
-
-    /**
-     * 乐观锁
-     * @return string
-     */
-    public function optimisticLock()
-    {
-        return 'VER';
-    }
-
-    /**
-     * 获取一名会员的余额
-     * @param $userId
-     * @return array|null
-     */
-    public static function getBonusByUserId($userId){
-        $data = UserBonus::findOneAsArray('USER_ID=:USER_ID', [':USER_ID'=>$userId], 'USER_ID,BONUS,CF,LX');
-        if(!$data){
-            $data = [
-                'USER_ID' => $userId,
-                'BONUS' => 0,
-                'CF' => 0,
-                'LX' => 0,
-            ];
-        }
-        return $data;
-    }
-}

+ 0 - 74
common/models/UserClose.php

@@ -1,74 +0,0 @@
-<?php
-
-namespace common\models;
-
-use common\helpers\Cache;
-use common\helpers\Date;
-use common\helpers\Form;
-use common\helpers\Tool;
-use Yii;
-
-/**
- * This is the model class for table "{{%USER_CLOSE}}".
- *
- * @property string $ID
- * @property string $USER_ID 会员ID
- * @property int $TYPE 类型
- * @property int $IS_MANUAL 是否手动操作
- * @property int $PERIOD_NUM 期数
- * @property int $IS_CLOSE 停|开
- * @property string $REMARK 备注
- * @property int $AUDIT_STATUS 审核状态
- * @property string $ADMIN_ID 操作管理员
- * @property string $AUDIT_ADMIN_ID 审核管理员
- * @property int $AUDITED_AT 审核时间
- * @property int $CREATED_AT 创建时间
- */
-class UserClose extends \common\components\ActiveRecord
-{
-    const TYPE_GT = 1;
-    const TYPE_TF = 2;
-
-    /**
-     * @inheritdoc
-     */
-    public static function tableName()
-    {
-        return '{{%USER_CLOSE}}';
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function rules()
-    {
-        return [
-            [['USER_ID', 'PERIOD_NUM', 'REMARK', 'CREATED_AT'], 'required'],
-            [['TYPE', 'IS_MANUAL', 'PERIOD_NUM', 'IS_CLOSE', 'AUDIT_STATUS', 'AUDITED_AT', 'CREATED_AT'], 'integer'],
-            [['ID', 'USER_ID', 'ADMIN_ID', 'AUDIT_ADMIN_ID'], 'string', 'max' => 32],
-            [['REMARK'], 'string', 'max' => 255],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_ID' => '会员ID',
-            'TYPE' => '类型',
-            'IS_MANUAL' => '是否手动操作',
-            'PERIOD_NUM' => '期数',
-            'IS_CLOSE' => '停|开',
-            'REMARK' => '备注',
-            'AUDIT_STATUS' => '审核状态',
-            'ADMIN_ID' => '操作管理员',
-            'AUDIT_ADMIN_ID' => '审核管理员',
-            'AUDITED_AT' => '审核时间',
-            'CREATED_AT' => '创建时间',
-        ];
-    }
-}

+ 0 - 171
common/models/UserMove.php

@@ -1,171 +0,0 @@
-<?php
-
-namespace common\models;
-
-use backendApi\modules\v1\models\Admin;
-use common\helpers\NetPoint;
-use common\helpers\user\Info;
-use Yii;
-use common\libs\logging\operate\valueType\Config as ValueTypeConfig;
-
-/**
- * This is the model class for table "{{%USER_MOVE}}".
- *
- * @property string $ID
- * @property string $USER_ID 移动的会员ID
- * @property string $FROM_UID 移动前接点UID
- * @property string $TO_UID 移动后接点UID
- * @property int $LOCATION 移动到位置
- * @property string $TYPE 移网类型
- * @property int $IS_MOVING 是否正在移动
- * @property int $MOVE_PERCENT 移动百分比
- * @property int $AUDIT_STATUS 审核状态
- * @property int $PERIOD_NUM 移动时的期数
- * @property int $UPDATE_PERIOD_NUM 修改期数
- * @property int $AUDIT_PERIOD_NUM 修改期数
- * @property string $MOVE_ADMIN_ID 移网管理员
- * @property string $AUDIT_ADMIN_ID 审核管理员
- * @property string $NET_TABLE_NAME 移点备份表名
- * @property string $CREATE_REMARK 创建备注
- * @property string $AUDIT_REMARK 审核备注
- * @property int $CREATED_AT 创建时间
- * @property int $STARTED_AT 移网开始时间
- * @property int $ENDED_AT 移网结束时间
- * @property int $AUDITED_AT 审核时间
- */
-class UserMove extends \common\components\ActiveRecord
-{
-    const TYPE_NETWORK = NetPoint::NET_TYPE_NETWORK;
-    const TYPE_RELATION = NetPoint::NET_TYPE_RELATION;
-
-    const TYPE_NAME = [
-        self::TYPE_NETWORK => ['id' => self::TYPE_NETWORK, 'name' => '安置网络',],
-        self::TYPE_RELATION => ['id' => self::TYPE_RELATION, 'name' => '开拓网络',],
-    ];
-
-    const STATUS_APPLIED = 0;       // 已申请
-    const STATUS_AUDITED = 1;       // 已审核
-    const STATUS_FAILED = 2;        // 审核失败
-    const STATUS_REFUSED = 3;       // 已拒绝
-
-    const STATUS_NAME = [
-        self::STATUS_APPLIED => '待审核',
-        self::STATUS_AUDITED => '审核通过',
-        self::STATUS_FAILED =>  '审核失败',
-        self::STATUS_REFUSED => '审核拒绝',
-    ];
-
-    /**
-     * @inheritdoc
-     */
-    public static function tableName()
-    {
-        return '{{%USER_MOVE}}';
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function rules()
-    {
-        return [
-            [['USER_ID', 'FROM_UID', 'TO_UID', 'TYPE', 'PERIOD_NUM', 'MOVE_ADMIN_ID', 'CREATED_AT'], 'required'],
-            [['LOCATION', 'IS_MOVING', 'MOVE_PERCENT', 'AUDIT_STATUS', 'PERIOD_NUM', 'UPDATE_PERIOD_NUM', 'AUDIT_PERIOD_NUM', 'CREATED_AT', 'STARTED_AT', 'ENDED_AT', 'AUDITED_AT'], 'integer'],
-            [['ID', 'USER_ID', 'FROM_UID', 'TO_UID', 'MOVE_ADMIN_ID', 'AUDIT_ADMIN_ID', 'NET_TABLE_NAME'], 'string', 'max' => 32],
-            [['TYPE'], 'string', 'max' => 48],
-            [['CREATE_REMARK', 'AUDIT_REMARK'], 'string', 'max' => 4000],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_ID' => '移动的会员ID',
-            'FROM_UID' => '移动前接点UID',
-            'TO_UID' => '移动后接点UID',
-            'LOCATION' => '移动到位置',
-            'TYPE' => '移网类型',
-            'IS_MOVING' => '是否正在移动',
-            'MOVE_PERCENT' => '移动百分比',
-            'AUDIT_STATUS' => '审核状态',
-            'PERIOD_NUM' => '移动时的期数',
-            'UPDATE_PERIOD_NUM' => '修改期数',
-            'AUDIT_PERIOD_NUM' => '修改期数',
-            'MOVE_ADMIN_ID' => '移网管理员',
-            'AUDIT_ADMIN_ID' => '审核管理员',
-            'NET_TABLE_NAME' => '移点备份表名',
-            'CREATE_REMARK' => '创建备注',
-            'AUDIT_REMARK' => '审核备注',
-            'CREATED_AT' => '创建时间',
-            'STARTED_AT' => '移网开始时间',
-            'ENDED_AT' => '移网结束时间',
-            'AUDITED_AT' => '审核时间',
-        ];
-    }
-
-    /**
-     * 操作日志记录条件
-     * @return array
-     */
-    public function attrLabelsWithLogType(){
-        return [
-            'USER_ID' => '移动的会员ID',
-            'FROM_UID' => [
-                'label' => '移动前上级',
-                'type' => function($data){
-                    $value = $data['value'];
-                    return Info::getUserNameByUserId($value);
-                },
-            ],
-            'TO_UID' => [
-                'label' => '移动后上级',
-                'type' => function($data){
-                    $value = $data['value'];
-                    return Info::getUserNameByUserId($value);
-                },
-            ],
-            'LOCATION' => '移动到位置',
-            'TYPE' => [
-                'label' => '移网类型',
-                'type' => function($data){
-                    $value = $data['value'];
-                    return $value==self::TYPE_NETWORK?'安置网络':'开拓网络';
-                },
-            ],
-            'AUDIT_STATUS' => [
-                'label' => '审核状态',
-                'type' => ValueTypeConfig::AUDIT_STATUS_TYPE,
-            ],
-            'MOVE_ADMIN_ID' => [
-                'label' => '创建人',
-                'type' => function($data){
-                    $value = $data['value'];
-                    $result = Admin::findOneAsArray('ID=:ID', [':ID'=>$value], 'ADMIN_NAME');
-                    return $result['ADMIN_NAME'];
-                },
-            ],
-            'AUDIT_ADMIN_ID' => [
-                'label' => '审核人',
-                'type' => function($data){
-                    $value = $data['value'];
-                    $result = Admin::findOneAsArray('ID=:ID', [':ID'=>$value], 'ADMIN_NAME');
-                    return $result['ADMIN_NAME'];
-                },
-            ],
-            'CREATE_REMARK' => '备注',
-            'CREATED_AT' => [
-                'label' => '创建时间',
-                'type' => ValueTypeConfig::DATE_TIME_TYPE,
-            ],
-            'AUDITED_AT' => [
-                'label' => '审核时间',
-                'type' => ValueTypeConfig::DATE_TIME_TYPE,
-            ],
-        ];
-    }
-}

+ 0 - 479
common/models/UserNetwork.php

@@ -1,479 +0,0 @@
-<?php
-
-namespace common\models;
-
-use common\components\ActiveRecord;
-use common\helpers\Cache;
-use common\helpers\NetPoint;
-use common\helpers\user\Info;
-use common\helpers\user\Perf;
-use Yii;
-use yii\data\Pagination;
-use yii\helpers\Json;
-
-/**
- * This is the model class for table "{{%USER_NETWORK}}".
- *
- * @property string $ID
- * @property string $USER_ID 会员ID
- * @property string $PARENT_UID 相对上级会员ID
- * @property int $LOCATION_TAG 网体标记
- * @property int $RELATIVE_LOCATION 相对上级会员区位
- * @property string $TOP_UID 顶端会员ID
- * @property string $PARENT_UIDS 所有上级ID
- * @property int $TOP_DEEP 距离顶端会员深度
- * @property int $CREATED_AT 创建时间
- * @property int $UPDATED_AT 更新时间
- */
-class UserNetwork extends \common\components\ActiveRecord
-{
-    /**
-     * @inheritdoc
-     */
-    public static function tableName()
-    {
-        return '{{%USER_NETWORK_NEW}}';
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function rules()
-    {
-        return [
-            [['USER_ID', 'PARENT_UID', 'LOCATION', 'TOP_UID', 'TOP_DEEP', 'CREATED_AT'], 'required'],
-            [['TOP_DEEP', 'PERIOD_NUM', 'RELATIVE_LOCATION', 'CREATED_AT', 'UPDATED_AT'], 'integer'],
-            [['ID', 'USER_ID', 'PARENT_UID', 'TOP_UID'], 'string', 'max' => 32],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_ID' => '会员ID',
-            'PARENT_UID' => '相对上级会员ID',
-            'LOCATION_TAG' => '网体标记',
-            'RELATIVE_LOCATION' => '相对父级的区位',
-            'TOP_UID' => '顶端会员ID',
-            'TOP_DEEP' => '距离顶端会员深度',
-            'PARENT_UIDS' => '所有上级ID',
-            'CREATED_AT' => '创建时间',
-            'UPDATED_AT' => '更新时间',
-        ];
-    }
-
-    /**
-     * 获取一层下级数量
-     * @param $userId
-     * @return int|string
-     */
-    public static function firstFloorChildNum($userId){
-        return intval(UserInfo::find()->where('CON_UID=:CON_UID AND DELETED=0', [':CON_UID'=>$userId])->count());
-    }
-
-    /**
-     * 分页获取上级会员
-     * @param $userId
-     * @param $offset
-     * @param $limit
-     * @param string $orderBy
-     * @param bool $isSlaves
-     * @param string $db
-     * @return array|\yii\db\ActiveRecord[]
-     */
-    public static function getParentsWithOffset($userId, $offset, $limit, $orderBy='DESC', $isSlaves = false, $db = 'db'){
-        $userNetInfo = static::find($isSlaves, $db)->select(['TOP_DEEP', 'PARENT_UIDS', 'LOCATION_TAG'])->where('USER_ID=:USER_ID', ['USER_ID'=>$userId])->asArray()->one();
-        if( !$userNetInfo ) return [];
-
-        $parentUidsStr = $userNetInfo['PARENT_UIDS'];
-        if( !$parentUidsStr ) return [];
-
-        $parentUidsArr = explode(',', $parentUidsStr);
-        unset($parentUidsStr);
-        if( $orderBy === 'DESC' ) {
-            $parentUidsArr = array_reverse($parentUidsArr);
-        }
-        if( !$parentUidsArr ) return [];
-
-        $pageParentUids = array_slice($parentUidsArr, $offset, $limit);
-        unset($parentUidsArr);
-        $parentList = [];
-        foreach ($pageParentUids as $parentUid) {
-            $parentNetInfo = static::find($isSlaves, $db)->select(['TOP_DEEP', 'LOCATION_TAG'])->where('USER_ID=:USER_ID', ['USER_ID'=>$parentUid])->asArray()->one();
-            $parentList[] = [
-                'USER_ID' => $userId,
-                'TOP_DEEP' => $userNetInfo['TOP_DEEP'],
-                'PARENT_UID' => $parentUid,
-                'PARENT_DEEP' => $parentNetInfo['TOP_DEEP'],
-//                'LOCATION_TAG' => $userNetInfo['LOCATION_TAG'],
-//                'PARENT_LOCATION_TAG' => $parentNetInfo['LOCATION_TAG'],
-                'LOCATION' => substr($userNetInfo['LOCATION_TAG'], strlen($parentNetInfo['LOCATION_TAG']), 1),
-            ];
-
-            unset($parentUid, $parentNetInfo);
-        }
-        unset($pageParentUids, $userNetInfo);
-
-        return $parentList;
-    }
-
-    /**
-     * 分页获取上级会员结算库
-     * @param $userId
-     * @param $callbackFunc
-     * @param $limit
-     * @param int $offset
-     * @param string $orderBy
-     */
-    public static function getParentsWithOffsetFromDbCalc($userId, $callbackFunc, $limit, $offset = 0, $orderBy='DESC'){
-        $allData = self::getParentsWithOffset($userId, $offset, $limit, $orderBy, false, 'dbCalc');
-        if($allData){
-            foreach($allData as $data){
-                $callbackFunc($data);
-                unset($data);
-            }
-            unset($allData);
-            self::getParentsWithOffsetFromDbCalc($userId, $callbackFunc, $limit, $offset + $limit);
-        }
-    }
-
-    /**
-     * 获取上一级父级的会员信息
-     * @param $userId
-     * @return array|null
-     */
-    public static function getFirstParentUserInfo($userId){
-        $oneUserInfo = UserInfo::findOneAsArray(['USER_ID'=>$userId]);
-        if($oneUserInfo['CON_UID']){
-            return UserInfo::findOneAsArray(['USER_ID'=>$oneUserInfo['CON_UID']]);
-        } else {
-            return null;
-        }
-    }
-
-    /**
-     * 获取指定深度的子会员
-     * @param $userId
-     * @param $deep
-     * @param string $orderBy
-     * @return array
-     */
-    public static function getChildrenWithDeep($userId, $deep, $orderBy='TOP_DEEP ASC'){
-        $userNetInfo = static::find()->select(['LOCATION_TAG', 'TOP_DEEP'])->where('USER_ID=:USER_ID', ['USER_ID'=>$userId])->asArray()->one();
-
-        $childrenNetInfo = static::find()->select(['USER_ID', 'LOCATION_TAG', 'TOP_DEEP'])->where('LOCATION_TAG LIKE :LOCATION_TAG AND TOP_DEEP<=:TOP_DEEP', ['LOCATION_TAG'=>$userNetInfo['LOCATION_TAG'] . '%', 'TOP_DEEP'=>$userNetInfo['TOP_DEEP'] + $deep])->orderBy($orderBy)->asArray()->all();
-        foreach ($childrenNetInfo as $key => $childNetInfo) {
-            $childrenNetInfo[$key]['LOCATION'] = substr($childNetInfo['LOCATION_TAG'], strlen($userNetInfo['LOCATION_TAG']), 1);
-            unset($key, $childNetInfo);
-        }
-
-        unset($userNetInfo);
-
-        return $childrenNetInfo;
-    }
-
-    /**
-     * 获取下一层会员的接点信息
-     * @param $userId
-     * @return array|\yii\db\ActiveRecord[]
-     */
-    public static function getFirstFloorChildren($userId) {
-        $childrenNetInfo = static::find()->select(['USER_ID', 'RELATIVE_LOCATION', 'LOCATION_TAG', 'TOP_DEEP'])->where('PARENT_UID=:PARENT_UID', ['PARENT_UID'=>$userId])->asArray()->all();
-        unset($userNetInfo);
-
-        return $childrenNetInfo;
-    }
-
-    /**
-     * 查看所传父级节点会员是不是所传会员的父级
-     * @param $userId
-     * @param $parentUserId
-     * @param null $periodNum
-     * @return bool
-     * @throws \yii\db\Exception
-     */
-    public static function isParentUser($userId, $parentUserId, $periodNum = null){
-        $table = self::getTableNameFromPeriod($periodNum);
-        $db = $table['db'];
-        $tableName = $table['tableName'];
-        $data = $db->createCommand("SELECT PARENT_UIDS FROM {$tableName} WHERE USER_ID=:USER_ID")->bindValues([':USER_ID'=>$userId])->queryOne();
-        if( !$data ) {
-            unset($table, $db, $tableName, $data);
-            return false;
-        }
-        $parentListArr = explode(',', $data['PARENT_UIDS']);
-        unset($table, $db, $tableName, $data);
-        $existStatus =  in_array($parentUserId, $parentListArr);
-        unset($parentListArr);
-
-        return $existStatus;
-    }
-
-    /**
-     * 获取会员相较于父级的区位
-     * @param $userId
-     * @param $parentUserId
-     * @param $periodNum
-     * @return mixed|null
-     */
-    public static function getLocation($userId, $parentUserId, $periodNum = null){
-        $table = self::getTableNameFromPeriod($periodNum);
-        $db = $table['db'];
-        $tableName = $table['tableName'];
-        $userNetInfo = $db->createCommand("SELECT LOCATION_TAG FROM $tableName WHERE USER_ID=:USER_ID")->bindValues([':USER_ID'=>$userId])->queryOne();
-        if( !$userNetInfo || !isset($userNetInfo['LOCATION_TAG']) ) return 0;
-
-        $parentNetInfo = $db->createCommand("SELECT LOCATION_TAG FROM $tableName WHERE USER_ID=:USER_ID")->bindValues([':USER_ID'=>$userId])->queryOne();
-        if( !$parentNetInfo || !isset($parentNetInfo['LOCATION_TAG']) ) return 0;
-
-        $location = substr($userNetInfo['LOCATION_TAG'], strlen($parentNetInfo['LOCATION_TAG']), 1);
-
-        return $location ? $location : 0;
-    }
-
-    /**
-     * 获取子会员节点带着总深度和循环的子节点层级关系
-     * @param $userId
-     * @param $deep
-     * @param int $loopedDeep
-     * @param null $periodNum
-     * @return mixed
-     * @throws \yii\base\Exception
-     * @throws \yii\db\Exception
-     */
-    public static function getChildrenWithDeepAndLayer($userId, $deep, $loopedDeep = 1, $periodNum=null){
-        $allData = self::getChildrenFromPeriod($userId, $periodNum);
-        if($allData){
-            $decLevelConfig = Cache::getDecLevelConfig();
-            $empLevelConfig = Cache::getEmpLevelConfig();
-            foreach($allData as $key=>$data){
-                // 获取用户的基本信息
-                $baseInfo = Info::baseInfo($data['USER_ID'], $periodNum);
-                $allData[$key] = array_merge($data, [
-                    'USER_NAME' => $baseInfo['USER_NAME'],
-                    'TOP_NETWORK_DEEP' => $data['TOP_DEEP'],
-                    'REAL_NAME' => $baseInfo['REAL_NAME'],
-                    'DEC_LV_NAME' => $decLevelConfig[$baseInfo['DEC_LV']]['LEVEL_NAME'],
-                    'EMP_LV_NAME' => isset($empLevelConfig[$baseInfo['EMP_LV']])?$empLevelConfig[$baseInfo['EMP_LV']]['LEVEL_NAME']:'',
-//                    'MOBILE' => $baseInfo['MOBILE'],
-                    'PERIOD_AT' => $baseInfo['PERIOD_AT'],
-                ]);
-                // 获取字节点数量
-                $childNum = self::firstFloorChildNumFromPeriod($data['USER_ID'], $periodNum);
-                if($childNum > 0 && $loopedDeep < $deep){
-                    $child = self::getChildrenWithDeepAndLayer($data['USER_ID'], $deep, $loopedDeep + 1, $periodNum);
-                    $leaf = false;
-                    $icon = 'el-icon-user-solid';
-                }
-                elseif($childNum > 0){
-                    $child = null;
-                    $leaf = false;
-                    $icon = 'el-icon-user-solid';
-                }
-                else {
-                    $child = null;
-                    $leaf = true;
-                    $icon = 'el-icon-user';
-                }
-                $allData[$key]['children'] = $child;
-                $allData[$key]['leaf'] = $leaf;
-                $allData[$key]['icon'] = $icon;
-                $allData[$key]['isExpanded'] = false;
-                $allData[$key]['displayNone'] = 'display-none';
-            }
-        }
-        return $allData;
-    }
-
-    /**
-     * 通过期数获取应该查询哪个表和库
-     * @param $periodNum
-     * @return array
-     */
-    public static function getTableNameFromPeriod($periodNum = null){
-        $db = self::getDb();
-        $tableName = self::tableName();
-//        if($periodNum !== null){
-//            // 获取当前期数
-//            $period = Period::instance();
-//            $nowPeriodNum = $period->getNowPeriodNum();
-//            if($nowPeriodNum != $periodNum){
-//                // 从备份库里找到期数对应的网络
-//                if(ActiveRecord::isExistsTable('{{%USER_NETWORK_'.$periodNum.'}}', 'dbNetPoint')){
-//                    $db = Yii::$app->dbNetPoint;
-//                    $tableName = '{{%USER_NETWORK_'.$periodNum.'}}';
-//                }
-//            }
-//        }
-        return [
-            'db' => $db,
-            'tableName' => $tableName,
-        ];
-    }
-
-    /**
-     * 获取指定深度的子会员从指定的期数中
-     * @param $userId
-     * @param $periodNum
-     * @return array|\yii\db\DataReader
-     * @throws \yii\db\Exception
-     */
-    public static function getChildrenFromPeriod($userId, $periodNum=null){
-        $table = self::getTableNameFromPeriod($periodNum);
-        $db = $table['db'];
-        $tableName = $table['tableName'];
-        return $db->createCommand("SELECT USER_ID,TOP_DEEP,RELATIVE_LOCATION FROM {$tableName} WHERE PARENT_UID=:PARENT_UID")->bindValues([':PARENT_UID'=>$userId])->queryAll();
-    }
-
-    /**
-     * 获取指定层数的这一层的会员以分页的方式
-     * @param $userId
-     * @param $deep
-     * @param null $periodNum
-     * @param array $params
-     * @return array
-     */
-    public static function getChildrenInDeepFromPeriodWithPage($userId, $deep, $periodNum=null, $params=[]){
-        $pageSize = method_exists(\Yii::$app->request,'get')?\Yii::$app->request->get('pageSize', \Yii::$app->params['pageSize']):\Yii::$app->params['pageSize'];
-        if(isset($params['pageSize'])) $pageSize=$params['pageSize'];
-
-        $page = null;
-        if( isset($params['page']) ) $page=$params['page'];
-
-        $orderBy = 'TOP_DEEP ASC, ID ASC';
-        if( isset($params['orderBy']) ) $orderBy = $params['orderBy'];
-        $table = self::getTableNameFromPeriod($periodNum);
-        $db = $table['db'];
-        $tableName = $table['tableName'];
-        $userNetInfo = $db->createCommand("SELECT LOCATION_TAG,TOP_DEEP FROM {$tableName} WHERE USER_ID=:USER_ID")->bindValues([':USER_ID'=>$userId])->queryOne();
-        $userDeep = $userNetInfo['TOP_DEEP'];
-        $userLocationTag = $userNetInfo['LOCATION_TAG'];
-        $totalCountSql = "SELECT COUNT(ID) AS TOTAL_COUNT FROM {$tableName} WHERE LOCATION_TAG LIKE :LOCATION_TAG AND TOP_DEEP<=:TOP_DEEP AND INSTR(`PARENT_UIDS`,'{$userId}')>0  ORDER BY {$orderBy}";
-        $totalCount = $db->createCommand($totalCountSql)->bindValues([':LOCATION_TAG'=>$userLocationTag . '%', ':TOP_DEEP'=>$userDeep + $deep])->queryOne();
-        $count = $totalCount['TOTAL_COUNT'];
-        $pagination = new Pagination(['totalCount' => $count]);
-        $pagination->setPageSize($pageSize);
-        if( $page !== null ) {
-            $pagination->setPage($page);
-        }
-        $offset = $pagination->offset;
-        $limit = $pagination->limit;
-//        $end = $offset + $limit;
-        $listSql = "SELECT * FROM $tableName WHERE LOCATION_TAG LIKE :LOCATION_TAG AND TOP_DEEP<=:TOP_DEEP AND INSTR(`PARENT_UIDS`,'{$userId}')>0 ORDER BY {$orderBy} LIMIT {$limit} OFFSET {$offset}";
-        $lists = $db->createCommand($listSql)->bindValues([':LOCATION_TAG'=>$userLocationTag . '%', ':TOP_DEEP'=>$userDeep + $deep])->queryAll();
-        return [
-            'list' => $lists ? $lists : [],
-            'pagination' => $pagination,
-            'currentPage'=>$pagination->page,
-            'totalPages'=>$pagination->pageCount,
-            'totalCount' => $pagination->totalCount,
-            'pageSize' => $pagination->pageSize,
-        ];
-    }
-
-    /**
-     * 获取所有的上级会员带着分页和期数
-     * @param $userId
-     * @param null $periodNum
-     * @param null $deep
-     * @return array
-     */
-    public static function getAllParentFromPeriodWithPage($userId, $periodNum=null, $deep=null){
-        $pageSize = method_exists(\Yii::$app->request,'get')?\Yii::$app->request->get('pageSize', \Yii::$app->params['pageSize']):\Yii::$app->params['pageSize'];
-        $table = self::getTableNameFromPeriod($periodNum);
-        $db = $table['db'];
-        $tableName = $table['tableName'];
-        $sql = "SELECT * FROM {$tableName} WHERE USER_ID=:USER_ID";
-        $oneData = $db->createCommand($sql)->bindValues([':USER_ID'=>$userId])->queryOne();
-        $userDeep = $oneData['TOP_DEEP'];
-        $parentUidsStr = $oneData['PARENT_UIDS'] ?? "";
-        if( !$parentUidsStr ) return [];
-
-        $parentUidsArr = explode(',', $parentUidsStr);
-        $parentUidsFlip = array_reverse($parentUidsArr);
-        if ($deep != null) {
-            $parentUidsFlip = array_slice($parentUidsFlip, 0, $deep);
-        }
-        $count = count($parentUidsFlip);
-        $pagination = new Pagination(['totalCount' => $count]);
-        $pagination->setPageSize($pageSize);
-        $offset = $pagination->offset;
-        $limit = $pagination->limit;
-
-        $parentUidList = array_slice($parentUidsFlip, $offset, $limit);
-        $lists = [];
-        foreach ($parentUidList as $parentUid) {
-            $sql = "SELECT * FROM {$tableName} WHERE USER_ID=:USER_ID";
-            $data = $db->createCommand($sql)->bindValues([':USER_ID' => $parentUid])->queryOne();
-            if( !$data ) continue;
-
-            $data['LOCATION'] = substr($oneData['LOCATION_TAG'], strlen($data['LOCATION_TAG']), 1);
-            $lists[] = $data;
-        }
-
-        return [
-            'list' => $lists ? $lists : [],
-            'pagination' => $pagination,
-            'currentPage' => $pagination->page,
-            'totalPages' => $pagination->pageCount,
-            'totalCount' => $pagination->totalCount,
-            'pageSize' => $pagination->pageSize,
-            'listTopDeep' => $userDeep,
-        ];
-    }
-
-    /**
-     * 获取一层下级数量从期数
-     * @param $userId
-     * @param null $periodNum
-     * @return int
-     */
-    public static function firstFloorChildNumFromPeriod($userId, $periodNum=null){
-        $table = self::getTableNameFromPeriod($periodNum);
-        $db = $table['db'];
-        $tableName = $table['tableName'];
-        $count = $db->createCommand("SELECT COUNT(ID) AS ID_COUNT FROM {$tableName} WHERE PARENT_UID=:PARENT_UID")->bindValues([':PARENT_UID'=>$userId])->queryOne();
-        return intval($count['ID_COUNT']);
-    }
-
-    /**
-     * 从缓存中获取会员的全部父级(主要用于结算时的处理,能够提高效率不去查库)
-     * @param $userId
-     * @return array|mixed
-     */
-    public static function getAllParentsFromRedis($userId){
-        $key = Cache::USER_NETWORK_PARENTS;
-        $data = Yii::$app->redis->hget($key, $userId);
-        if(!$data){
-            $data = [];
-            self::getParentsWithOffsetFromDbCalc($userId, function($oneData) use(&$data){
-                $data[] = $oneData;
-            }, 100);
-            $data = Json::encode($data);
-            Yii::$app->redis->hset($key, $userId, $data);
-        }
-        return $data ? Json::decode($data) : [];
-    }
-
-    /**
-     * 判断在某个区位是否存在会员
-     * @param $userId
-     * @param $location
-     * @return bool
-     */
-    public static function issetUserInLocation($userId, $location){
-        $childrenNetList = UserNetwork::find()->select(['LOCATION_TAG'])->where('PARENT_UID=:PARENT_UID', [':PARENT_UID' => $userId])->asArray()->all();
-        foreach ($childrenNetList as $everyData) {
-            //取最后一位数
-            $everyLocation = substr($everyData['LOCATION_TAG'], -1);
-            if( $everyLocation == $location ) return true;
-        }
-
-        return false;
-    }
-}

+ 0 - 220
common/models/UserPerf.php

@@ -1,220 +0,0 @@
-<?php
-
-namespace common\models;
-
-use common\helpers\user\Info;
-use Yii;
-
-/**
- * This is the model class for table "{{%USER_PERF}}".
- *
- * @property string $ID ID
- * @property string $USER_ID 会员ID
- * @property string $PV_PCS_ZC 个人注册单累计
- * @property string $PV_PCS_YH 个人优惠单累计
- * @property string $PV_PCS_ZG 个人增购单累计
- * @property string $PV_PCS_LS 个人零售单累计
- * @property string $PV_PCS_FX 个人复销单累计
- * @property string $PV_1L 一市场累计业绩
- * @property string $PV_2L 二市场累计业绩
- * @property string $PV_3L 三市场累计业绩
- * @property string $PV_4L 四市场累计业绩
- * @property string $PV_5L 五市场累计业绩
- * @property int $CREATED_AT 创建时间
- * @property string $PV_PSS 推荐团队累计业绩
- * @property string $SURPLUS_1L 一市场结余业绩
- * @property string $SURPLUS_1L_ZC 一市场首购结余业绩
- * @property string $SURPLUS_1L_FX 一市场复消结余业绩
- * @property string $SURPLUS_2L 二市场结余业绩
- * @property string $SURPLUS_2L_ZC 二市场首购结余业绩
- * @property string $SURPLUS_2L_FX 二市场复消结余业绩
- * @property string $SURPLUS_3L 三市场结余业绩
- * @property string $SURPLUS_3L_ZC 三市场首购结余业绩
- * @property string $SURPLUS_3L_FX 三市场复消结余业绩
- * @property string $SURPLUS_4L 四市场结余业绩
- * @property string $SURPLUS_4L_ZC 四市场首购结余业绩
- * @property string $SURPLUS_4L_FX 四市场复消结余业绩
- * @property string $SURPLUS_5L 五市场结余业绩
- * @property string $SURPLUS_5L_ZC 五市场首购结余业绩
- * @property string $SURPLUS_5L_FX 五市场复消结余业绩
- * @property string $VIP_SURPLUS_1L_ZC VIP一市场剩余报单业绩
- * @property string $VIP_SURPLUS_2L_ZC VIP二市场剩余报单业绩
- * @property string $VIP_SURPLUS_3L_ZC VIP三市场剩余报单业绩
- * @property string $VIP_SURPLUS_4L_ZC VIP四市场剩余报单业绩
- * @property string $VIP_SURPLUS_5L_ZC VIP五市场剩余报单业绩
- * @property string $PV_PSS_TOTAL 推荐团队累计业绩
- */
-class UserPerf extends \common\components\ActiveRecord
-{
-    /**
-     * @inheritdoc
-     */
-    public static function tableName()
-    {
-        return '{{%USER_PERF}}';
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function rules()
-    {
-        return [
-            [['USER_ID', 'CREATED_AT'], 'required'],
-            [['PV_PCS_ZC', 'PV_PCS_YH', 'PV_PCS_ZG', 'PV_PCS_LS', 'PV_PCS_FX', 'PV_1L', 'PV_2L', 'PV_3L', 'PV_4L', 'PV_5L', 'PV_PSS', 'SURPLUS_1L', 'SURPLUS_1L_ZC', 'SURPLUS_1L_FX', 'SURPLUS_2L', 'SURPLUS_2L_ZC', 'SURPLUS_2L_FX', 'SURPLUS_3L', 'SURPLUS_3L_ZC', 'SURPLUS_3L_FX', 'SURPLUS_4L', 'SURPLUS_4L_ZC', 'SURPLUS_4L_FX', 'SURPLUS_5L', 'SURPLUS_5L_ZC', 'SURPLUS_5L_FX', 'VIP_SURPLUS_1L_ZC', 'VIP_SURPLUS_2L_ZC', 'VIP_SURPLUS_3L_ZC', 'VIP_SURPLUS_4L_ZC', 'VIP_SURPLUS_5L_ZC', 'PV_PSS_TOTAL'], 'number'],
-            [['CREATED_AT'], 'integer'],
-            [['USER_ID', 'ID'], 'string', 'max' => 32],
-            [['USER_ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_ID' => '会员ID',
-            'PV_PCS_ZC' => '个人注册单累计',
-            'PV_PCS_YH' => '个人优惠单累计',
-            'PV_PCS_ZG' => '个人增购单累计',
-            'PV_PCS_LS' => '个人零售单累计',
-            'PV_PCS_FX' => '个人复销单累计',
-            'PV_1L' => '一市场累计业绩',
-            'PV_2L' => '二市场累计业绩',
-            'PV_3L' => '三市场累计业绩',
-            'PV_4L' => '四市场累计业绩',
-            'PV_5L' => '五市场累计业绩',
-            'CREATED_AT' => '创建时间',
-            'PV_PSS' => '推荐团队累计业绩',
-            'SURPLUS_1L' => '一市场结余业绩',
-            'SURPLUS_1L_ZC' => '一市场首购结余业绩',
-            'SURPLUS_1L_FX' => '一市场复消结余业绩',
-            'SURPLUS_2L' => '二市场结余业绩',
-            'SURPLUS_2L_ZC' => '二市场首购结余业绩',
-            'SURPLUS_2L_FX' => '二市场复消结余业绩',
-            'SURPLUS_3L' => '三市场结余业绩',
-            'SURPLUS_3L_ZC' => '三市场首购结余业绩',
-            'SURPLUS_3L_FX' => '三市场复消结余业绩',
-            'SURPLUS_4L' => '四市场结余业绩',
-            'SURPLUS_4L_ZC' => '四市场首购结余业绩',
-            'SURPLUS_4L_FX' => '四市场复消结余业绩',
-            'SURPLUS_5L' => '五市场结余业绩',
-            'SURPLUS_5L_ZC' => '五市场首购结余业绩',
-            'SURPLUS_5L_FX' => '五市场复消结余业绩',
-            'VIP_SURPLUS_1L_ZC' => 'VIP一市场剩余报单业绩',
-            'VIP_SURPLUS_2L_ZC' => 'VIP二市场剩余报单业绩',
-            'VIP_SURPLUS_3L_ZC' => 'VIP三市场剩余报单业绩',
-            'VIP_SURPLUS_4L_ZC' => 'VIP四市场剩余报单业绩',
-            'VIP_SURPLUS_5L_ZC' => 'VIP五市场剩余报单业绩',
-            'PV_PSS_TOTAL' => '推荐团队累计业绩',
-        ];
-    }
-
-    /**
-     * 用户累计业绩(默认主库)
-     * @param $userId
-     * @param string $db
-     * @param bool $isSlaves
-     * @return array|null|\yii\db\ActiveRecord
-     */
-    public static function getOneUserPerf($userId, $db = 'db', $isSlaves = false){
-        $data = static::find($isSlaves, $db)->select('USER_ID,PV_PCS_ZC,PV_PCS_FX,PV_PSS,PV_1L,PV_2L,PV_3L,PV_4L,PV_5L,SURPLUS_1L,SURPLUS_2L,SURPLUS_3L,SURPLUS_4L,SURPLUS_5L,SURPLUS_1L_ZC,SURPLUS_2L_ZC,SURPLUS_3L_ZC,SURPLUS_4L_ZC,SURPLUS_5L_ZC,SURPLUS_1L_FX,SURPLUS_2L_FX,SURPLUS_3L_FX,SURPLUS_4L_FX,SURPLUS_5L_FX,VIP_SURPLUS_1L_ZC,VIP_SURPLUS_2L_ZC,VIP_SURPLUS_3L_ZC,VIP_SURPLUS_4L_ZC,VIP_SURPLUS_5L_ZC,PV_PSS_TOTAL')->where('USER_ID=:USER_ID', [':USER_ID'=>$userId])->asArray()->one();
-        if(!$data){
-            $data = [
-                'USER_ID' => $userId,
-                'PV_PCS_ZC' => 0,
-                'PV_PCS_FX' => 0,
-                'PV_PSS' => 0,
-                'PV_1L' => 0,
-                'PV_2L' => 0,
-                'PV_3L' => 0,
-                'PV_4L' => 0,
-                'PV_5L' => 0,
-                'SURPLUS_1L' => 0,
-                'SURPLUS_2L' => 0,
-                'SURPLUS_3L' => 0,
-                'SURPLUS_4L' => 0,
-                'SURPLUS_5L' => 0,
-                'SURPLUS_1L_ZC' => 0,
-                'SURPLUS_2L_ZC' => 0,
-                'SURPLUS_3L_ZC' => 0,
-                'SURPLUS_4L_ZC' => 0,
-                'SURPLUS_5L_ZC' => 0,
-                'SURPLUS_1L_FX' => 0,
-                'SURPLUS_2L_FX' => 0,
-                'SURPLUS_3L_FX' => 0,
-                'SURPLUS_4L_FX' => 0,
-                'SURPLUS_5L_FX' => 0,
-                'VIP_SURPLUS_1L_ZC' => 0,
-                'VIP_SURPLUS_2L_ZC' => 0,
-                'VIP_SURPLUS_3L_ZC' => 0,
-                'VIP_SURPLUS_4L_ZC' => 0,
-                'VIP_SURPLUS_5L_ZC' => 0,
-                'PV_PSS_TOTAL' => 0,
-            ];
-        }
-        return $data;
-    }
-
-    /**
-     * 操作日志记录条件
-     * @return array
-     */
-    public function attrLabelsWithLogType(){
-        return [
-            'USER_ID' => '会员ID',
-            'PV_1L' => '一市场累计业绩',
-            'PV_2L' => '二市场累计业绩',
-            'PV_3L' => '三市场累计业绩',
-            'PV_4L' => '四市场累计业绩',
-            'PV_5L' => '五市场累计业绩',
-            'PV_PSS' => '推荐团队累计业绩',
-        ];
-    }
-
-    /**
-     * 获取一名会员余额
-     * @param $userId
-     * @return array|null
-     */
-    public static function getPvByUserId($userId){
-        $data = self::findOneAsArray('USER_ID=:USER_ID', [':USER_ID'=>$userId], 'USER_ID,PV_1L,PV_2L,PV_3L,PV_4L,PV_5L,PV_PSS');
-        if(!$data){
-            $data = [
-                'USER_ID' => $userId,
-                'PV_1L' => 0,
-                'PV_2L' => 0,
-                'PV_3L' => 0,
-                'PV_4L' => 0,
-                'PV_5L' => 0,
-                'PV_PSS' => 0,
-            ];
-        }
-        return $data;
-    }
-
-    /**
-     * 获取当前结余业绩
-     * @param $userId
-     * @return array|\yii\db\ActiveRecord|null
-     * @throws \yii\db\Exception
-     */
-    public static function getPeriodSurplusPerf($userId){
-        $result = static::findUseDbCalc()->select('SURPLUS_1L,SURPLUS_2L,SURPLUS_3L,SURPLUS_4L,SURPLUS_5L')->where('USER_ID=:USER_ID', [':USER_ID'=>$userId])->asArray()->one();
-        if(!$result){
-            $result = [
-                'USER_ID' => $userId,
-                'SURPLUS_1L' => 0,
-                'SURPLUS_2L' => 0,
-                'SURPLUS_3L' => 0,
-                'SURPLUS_4L' => 0,
-                'SURPLUS_5L' => 0,
-                'SURPLUS_LS' => 0,
-            ];
-        }
-
-        return $result;
-    }
-}

+ 0 - 47
common/models/UserPerfMonthUpdate.php

@@ -1,47 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%USER_PERF_MONTH_UPDATE}}".
- *
- * @property string $USER_ID 会员ID
- * @property int $CALC_MONTH 更新时的年月
- * @property int $CREATED_AT 创建时间
- */
-class UserPerfMonthUpdate extends \common\components\ActiveRecord
-{
-    /**
-     * @inheritdoc
-     */
-    public static function tableName()
-    {
-        return '{{%USER_PERF_MONTH_UPDATE}}';
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function rules()
-    {
-        return [
-            [['USER_ID', 'CALC_MONTH', 'CREATED_AT'], 'required'],
-            [['CALC_MONTH', 'CREATED_AT'], 'integer'],
-            [['USER_ID'], 'string', 'max' => 32],
-        ];
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function attributeLabels()
-    {
-        return [
-            'USER_ID' => '会员ID',
-            'CALC_MONTH' => '更新时的年月',
-            'CREATED_AT' => '创建时间',
-        ];
-    }
-}

+ 0 - 50
common/models/UserPerfUpdate.php

@@ -1,50 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%USER_PERF_UPDATE}}".
- *
- * @property string $USER_ID 会员ID
- * @property int $PERIOD_NUM 更新时的期数
- * @property string $P_CALC_MONTH 更新时的结算月
- * @property int $CREATED_AT 创建时间
- */
-class UserPerfUpdate extends \common\components\ActiveRecord
-{
-    /**
-     * @inheritdoc
-     */
-    public static function tableName()
-    {
-        return '{{%USER_PERF_UPDATE}}';
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function rules()
-    {
-        return [
-            [['USER_ID', 'P_CALC_MONTH', 'CREATED_AT'], 'required'],
-            [['PERIOD_NUM', 'CREATED_AT'], 'integer'],
-            [['USER_ID'], 'string', 'max' => 32],
-            [['USER_ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function attributeLabels()
-    {
-        return [
-            'USER_ID' => '会员ID',
-            'PERIOD_NUM' => '更新时的期数',
-            'P_CALC_MONTH' => '更新时的结算月',
-            'CREATED_AT' => '创建时间',
-        ];
-    }
-}

+ 0 - 59
common/models/UserPeriodPoints.php

@@ -1,59 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%USER_PERIOD_POINTS}}".
- *
- * @property string $ID
- * @property string $USER_ID 会员ID
- * @property int $PERIOD_NUM 报单期数
- * @property string $RECONSUME_POINTS 复消积分
- * @property string $REMAINDER_POINTS 剩余积分
- * @property int EXPIRED 是否过期
- * @property int EXPIRED_PERIOD 过期期数
- * @property int EXPIRED_AT 过期时间
- * @property int $CREATED_AT 创建时间
- */
-class UserPeriodPoints extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%USER_PERIOD_POINTS}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['USER_ID', 'PERIOD_NUM', 'CREATED_AT'], 'required'],
-            [['PERIOD_NUM', 'CREATED_AT', 'EXPIRED', 'EXPIRED_PERIOD', 'EXPIRED_AT'], 'integer'],
-            [['RECONSUME_POINTS', 'REMAINDER_POINTS'], 'number'],
-            [['ID', 'USER_ID'], 'string', 'max' => 32],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_ID' => '会员ID',
-            'RECONSUME_POINTS' => '复消积分',
-            'REMAINDER_POINTS' => '剩余积分',
-            'EXPIRED' => '是否过期',
-            'EXPIRED_PERIOD' => '过期期数',
-            'EXPIRED_AT' => '过期时间',
-            'CREATED_AT' => '创建时间',
-        ];
-    }
-}

+ 0 - 61
common/models/UserReg.php

@@ -1,61 +0,0 @@
-<?php
-
-namespace common\models;
-
-use Yii;
-
-/**
- * This is the model class for table "{{%USER_REG}}".
- *
- * @property string $ID
- * @property string $USER_NAME 编号
- * @property string $REAL_NAME 姓名
- * @property string $CON_UID 安置ID
- * @property string $REC_UID 上级ID
- * @property string $PARENT_USER_NAME 上级编号
- * @property string $PARENT_REAL_NAME 上级姓名
- * @property string $NET_USER_NAME 安置人编号
- * @property string $NET_REAL_NAME 安置人姓名
- */
-class UserReg extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%USER_REG}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['USER_NAME', 'REAL_NAME', 'PARENT_USER_NAME', 'PARENT_REAL_NAME', 'NET_USER_NAME', 'NET_REAL_NAME'], 'required'],
-            [['ID','CON_UID','REC_UID'], 'string', 'max' => 32],
-            [['USER_NAME', 'PARENT_USER_NAME', 'NET_USER_NAME'], 'string', 'max' => 16],
-            [['REAL_NAME', 'PARENT_REAL_NAME', 'NET_REAL_NAME'], 'string', 'max' => 128],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_NAME' => '编号',
-            'REAL_NAME' => '姓名',
-            'CON_UID' => '安置人ID',
-            'REC_UID' => '上级ID',
-            'PARENT_USER_NAME' => '上级编号',
-            'PARENT_REAL_NAME' => '上级姓名',
-            'NET_USER_NAME' => '安置人编号',
-            'NET_REAL_NAME' => '安置人姓名',
-        ];
-    }
-}

+ 0 - 364
common/models/UserRelation.php

@@ -1,364 +0,0 @@
-<?php
-
-namespace common\models;
-
-use common\components\ActiveRecord;
-use common\helpers\Cache;
-use common\helpers\NetPoint;
-use common\helpers\user\Info;
-use Yii;
-use yii\data\Pagination;
-use yii\helpers\Json;
-
-/**
- * This is the model class for table "{{%USER_RELATION}}".
- *
- * @property string $ID
- * @property string $USER_ID 会员ID
- * @property string $PARENT_UID 相对上级会员ID
- * @property string $TOP_UID 顶端会员ID
- * @property int $TOP_DEEP 距离顶端会员深度
- * @property int $PARENT_UIDS 所有的上级ID
- * @property int $CREATED_AT 创建时间
- * @property int $UPDATED_AT 更新时间
- */
-class UserRelation extends \common\components\ActiveRecord
-{
-    /**
-     * @inheritdoc
-     */
-    public static function tableName()
-    {
-        return '{{%USER_RELATION_NEW}}';
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function rules()
-    {
-        return [
-            [['USER_ID', 'PARENT_UID', 'TOP_UID', 'TOP_DEEP', 'CREATED_AT'], 'required'],
-            [['TOP_DEEP', 'CREATED_AT', 'UPDATED_AT'], 'integer'],
-            [['ID', 'USER_ID', 'PARENT_UID', 'TOP_UID'], 'string', 'max' => 32],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_ID' => '会员ID',
-            'PARENT_UID' => '相对上级会员ID',
-            'TOP_UID' => '顶端会员ID',
-            'TOP_DEEP' => '距离顶端会员深度',
-            'PARENT_UIDS' => '所有的上级ID',
-            'CREATED_AT' => '创建时间',
-            'UPDATED_AT' => '更新时间',
-        ];
-    }
-
-
-    /**
-     * 获取一层下级数量
-     * @param $userId
-     * @return int|string
-     */
-    public static function firstFloorChildNum($userId){
-        return intval(UserInfo::find()->where('REC_UID=:REC_UID', [':REC_UID'=>$userId])->count());
-    }
-
-
-    /**
-     * 分页获取上级会员
-     * @param $userId
-     * @param $offset
-     * @param $limit
-     * @param string $orderBy
-     * @param bool $isSlaves
-     * @param string $db
-     * @return array|\yii\db\ActiveRecord[]
-     */
-    public static function getParentsWithOffset($userId, $offset, $limit, $orderBy = 'DESC', $isSlaves = false, $db = 'db'){
-        $userRelationInfo = static::find($isSlaves, $db)->select(['TOP_DEEP', 'PARENT_UIDS'])->where('USER_ID=:USER_ID', ['USER_ID'=>$userId])->asArray()->one();
-        if( !$userRelationInfo ) return [];
-
-        $parentUidsStr = $userRelationInfo['PARENT_UIDS'];
-        if( !$parentUidsStr ) return [];
-        $parentUidsArr = explode(',', $parentUidsStr);
-        unset($parentUidsStr);
-        if( $orderBy === 'DESC' ) {
-            $parentUidsArr = array_reverse($parentUidsArr);
-        }
-        if( !$parentUidsArr ) return [];
-
-        $pageParentUids = array_slice($parentUidsArr, $offset, $limit);
-        unset($parentUidsArr);
-        $parentList = [];
-        foreach ($pageParentUids as $parentUid) {
-            $parentRelationInfo = static::find($isSlaves, $db)->select(['TOP_DEEP'])->where('USER_ID=:USER_ID', ['USER_ID'=>$parentUid])->asArray()->one();
-            $parentList[] = [
-                'USER_ID' => $userId,
-                'TOP_DEEP' => $userRelationInfo['TOP_DEEP'],
-                'PARENT_UID' => $parentUid,
-                'PARENT_DEEP' => $parentRelationInfo['TOP_DEEP'],
-            ];
-
-            unset($parentUid, $parentRelationInfo);
-        }
-        unset($pageParentUids, $userRelationInfo);
-
-        return $parentList;
-    }
-
-    /**
-     * 分页获取上级会员结算库
-     * @param $userId
-     * @param $callbackFunc
-     * @param $limit
-     * @param int $offset
-     * @param string $orderBy
-     */
-    public static function getParentsWithOffsetFromDbCalc($userId, $callbackFunc, $limit, $offset = 0, $orderBy='DESC'){
-        $allData = self::getParentsWithOffset($userId, $offset, $limit, $orderBy, false, 'dbCalc');
-        if($allData){
-            foreach($allData as $data){
-                $callbackFunc($data);
-                unset($data);
-            }
-            unset($allData);
-            self::getParentsWithOffsetFromDbCalc($userId, $callbackFunc, $limit, $offset + $limit);
-        }
-    }
-
-    /**
-     * 获取上一级父级的会员信息
-     * @param $userId
-     * @return array|null
-     */
-    public static function getFirstParentUserInfo($userId){
-        $oneUserInfo = UserInfo::findOneAsArray(['USER_ID'=>$userId]);
-        if($oneUserInfo['REC_UID']){
-            return UserInfo::findOneAsArray(['USER_ID'=>$oneUserInfo['REC_UID']]);
-        } else {
-            return null;
-        }
-    }
-
-    /**
-     * 查看所传父级节点会员是不是所传会员的父级
-     * @param $userId
-     * @param $parentUserId
-     * @param $periodNum
-     * @return bool
-     */
-    public static function isParentUser($userId, $parentUserId, $periodNum = null){
-        $table = self::getTableNameFromPeriod($periodNum);
-        $db = $table['db'];
-        $tableName = $table['tableName'];
-        $data = $db->createCommand("SELECT PARENT_UIDS FROM {$tableName} WHERE USER_ID=:USER_ID")->bindValues([':USER_ID'=>$userId])->queryOne();
-        if( !$data ) {
-            unset($table, $db, $tableName, $data);
-            return false;
-        }
-        $parentListArr = explode(',', $data['PARENT_UIDS']);
-        unset($table, $db, $tableName, $data);
-        $existStatus =  in_array($parentUserId, $parentListArr);
-        unset($parentListArr);
-
-        return $existStatus;
-    }
-
-    /**
-     * 获取相交于父级的深度
-     * @param $userId
-     * @param $parentUserId
-     * @param bool $isSlave
-     * @return mixed|null
-     */
-    public static function deepWithParent($userId, $parentUserId, $isSlave = false){
-        $userRelationInfo = static::find($isSlave)->select(['TOP_DEEP'])->where('USER_ID=:USER_ID', [':USER_ID'=>$userId])->asArray()->one();
-        if( !$userRelationInfo ) return null;
-        $parentRelationInfo = static::find($isSlave)->select(['TOP_DEEP'])->where('PARENT_UID=:PARENT_UID', [':PARENT_UID'=>$parentUserId])->asArray()->one();
-        if( !$parentRelationInfo ) return null;
-
-
-        return $parentRelationInfo['TOP_DEEP'] - $userRelationInfo['TOP_DEEP'];
-    }
-
-    /**
-     * 获取子会员节点带着总深度和循环的子节点层级关系
-     * @param $userId
-     * @param $deep
-     * @param int $loopedDeep
-     * @param null $periodNum
-     * @return mixed
-     * @throws \yii\base\Exception
-     * @throws \yii\db\Exception
-     */
-    public static function getChildrenWithDeepAndLayer($userId, $deep, $loopedDeep = 1, $periodNum=null){
-        $allData = self::getFirstFloorChildrenFromPeriod($userId,'TOP_DEEP ASC', $periodNum);
-        if($allData){
-            $decLevelConfig = Cache::getDecLevelConfig();
-            $empLevelConfig = Cache::getEmpLevelConfig();
-            foreach($allData as $key=>$data){
-                // 获取用户的基本信息
-                $baseInfo = Info::baseInfo($data['USER_ID'], $periodNum);
-                $allData[$key] = array_merge($data, [
-                    'USER_NAME' => $baseInfo['USER_NAME'],
-                    'TOP_RELATION_DEEP' => $data['TOP_DEEP'],
-                    'REAL_NAME' => $baseInfo['REAL_NAME'],
-                    'DEC_LV_NAME' => $decLevelConfig[$baseInfo['DEC_LV']]['LEVEL_NAME'],
-                    'EMP_LV_NAME' => isset($empLevelConfig[$baseInfo['EMP_LV']])?$empLevelConfig[$baseInfo['EMP_LV']]['LEVEL_NAME']:'',
-                    'PERIOD_AT' => $baseInfo['PERIOD_AT'],
-                ]);
-                // 获取字节点数量
-                $childNum = self::firstFloorChildNumFromPeriod($data['USER_ID'], $periodNum);
-                if($childNum > 0 && $loopedDeep < $deep){
-                    $child = self::getChildrenWithDeepAndLayer($data['USER_ID'], $deep, $loopedDeep + 1, $periodNum);
-                    $leaf = false;
-                    $icon = 'el-icon-user-solid';
-                }
-                elseif($childNum > 0){
-                    $child = null;
-                    $leaf = false;
-                    $icon = 'el-icon-user-solid';
-                }
-                else {
-                    $child = null;
-                    $leaf = true;
-                    $icon = 'el-icon-user';
-                }
-                $allData[$key]['children'] = $child;
-                $allData[$key]['leaf'] = $leaf;
-                $allData[$key]['icon'] = $icon;
-                $allData[$key]['isExpanded'] = false;
-                $allData[$key]['displayNone'] = 'display-none';
-            }
-        }
-        return $allData;
-    }
-
-    /**
-     * 通过期数获取应该查询哪个表和库
-     * @param $periodNum
-     * @return array
-     */
-    public static function getTableNameFromPeriod($periodNum = null){
-        $db = self::getDb();
-        $tableName = self::tableName();
-//        if($periodNum !== null){
-//            // 获取当前期数
-//            $period = Period::instance();
-//            $nowPeriodNum = $period->getNowPeriodNum();
-//            if($nowPeriodNum != $periodNum){
-//                // 从备份库里找到期数对应的网络
-//                if(ActiveRecord::isExistsTable('{{%USER_RELATION_'.$periodNum.'}}', 'dbNetPoint')){
-//                    $db = Yii::$app->dbNetPoint;
-//                    $tableName = '{{%USER_RELATION_'.$periodNum.'}}';
-//                }
-//            }
-//        }
-        return [
-            'db' => $db,
-            'tableName' => $tableName,
-        ];
-    }
-
-    /**
-     * 获取直推子会员
-     * @param $userId
-     * @param string $orderBy
-     * @param null $periodNum
-     * @return mixed
-     */
-    public static function getFirstFloorChildrenFromPeriod($userId, $orderBy='TOP_DEEP ASC,ID ASC', $periodNum=null){
-        $table = self::getTableNameFromPeriod($periodNum);
-        $db = $table['db'];
-        $tableName = $table['tableName'];
-        return $db->createCommand("SELECT USER_ID,PARENT_UID,TOP_DEEP FROM {$tableName} WHERE PARENT_UID=:PARENT_UID ORDER BY {$orderBy}")->bindValues([':PARENT_UID'=>$userId])->queryAll();
-    }
-
-
-    /**
-     * 获取指定层数的这一层的会员以分页的方式
-     * @param $userId
-     * @param $deep
-     * @param null $periodNum
-     * @return array
-     */
-    public static function getChildrenInDeepFromPeriodWithPage($userId, $deep, $periodNum=null,$params=[]){
-        $pageSize = method_exists(\Yii::$app->request,'get')?\Yii::$app->request->get('pageSize', \Yii::$app->params['pageSize']):\Yii::$app->params['pageSize'];
-        if(isset($params['pageSize'])) $pageSize=$params['pageSize'];
-
-        $page = null;
-        if( isset($params['page']) ) $page=$params['page'];
-
-        $orderBy = 'TOP_DEEP ASC,ID ASC';
-        if( isset($params['orderBy']) ) $orderBy = $params['orderBy'];
-        $table = self::getTableNameFromPeriod($periodNum);
-        $db = $table['db'];
-        $tableName = $table['tableName'];
-        $userRecInfo = $db->createCommand("SELECT TOP_DEEP FROM $tableName WHERE USER_ID=:USER_ID")->bindValues([':USER_ID'=>$userId])->queryOne();
-        $userDeep = $userRecInfo['TOP_DEEP'];
-        $totalCountSql = "SELECT COUNT(ID) AS TOTAL_COUNT FROM $tableName WHERE INSTR(`PARENT_UIDS`,'{$userId}')>0 AND TOP_DEEP<=:TOP_DEEP ORDER BY {$orderBy}";
-        $totalCount = $db->createCommand($totalCountSql)->bindValues([ ':TOP_DEEP'=>$userDeep + $deep])->queryOne();
-        $count = $totalCount['TOTAL_COUNT'];
-        $pagination = new Pagination(['totalCount' => $count]);
-        if( $page !== null ) {
-            $pagination->setPage($page);
-        }
-        $pagination->setPageSize($pageSize);
-        $offset = $pagination->offset;
-        $limit = $pagination->limit;
-//        $end = $offset + $limit;
-        $listSql = "SELECT * FROM $tableName WHERE INSTR(`PARENT_UIDS`,'{$userId}')>0 AND TOP_DEEP<=:TOP_DEEP ORDER BY {$orderBy} LIMIT {$limit} OFFSET {$offset}";
-        $lists = $db->createCommand($listSql)->bindValues([ ':TOP_DEEP'=>$userDeep + $deep])->queryAll();
-        return [
-            'list' => $lists ? $lists : [],
-            'pagination' => $pagination,
-            'currentPage'=>$pagination->page,
-            'totalPages'=>$pagination->pageCount,
-            'totalCount' => $pagination->totalCount,
-            'pageSize' => $pagination->pageSize,
-        ];
-    }
-
-    /**
-     * 获取一层下级数量从期数
-     * @param $userId
-     * @param null $periodNum
-     * @return int
-     */
-    public static function firstFloorChildNumFromPeriod($userId, $periodNum=null){
-        $table = self::getTableNameFromPeriod($periodNum);
-        $db = $table['db'];
-        $tableName = $table['tableName'];
-        $count = $db->createCommand("SELECT COUNT(ID) AS ID_COUNT FROM $tableName WHERE PARENT_UID=:PARENT_UID")->bindValues([':PARENT_UID'=>$userId])->queryOne();
-        return intval($count['ID_COUNT']);
-    }
-
-
-    /**
-     * 从缓存中获取会员的全部父级(主要用于结算时的处理,能够提高效率不去查库)
-     * @param $userId
-     * @return array|mixed
-     */
-    public static function getAllParentsFromRedis($userId){
-        $key = Cache::USER_RELATION_PARENTS;
-        $data = Yii::$app->redis->hget($key, $userId);
-        if(!$data){
-            $data = [];
-            self::getParentsWithOffsetFromDbCalc($userId, function($oneData) use(&$data){
-                $data[] = $oneData;
-            }, 100);
-            $data = Json::encode($data);
-            Yii::$app->redis->hset($key, $userId, $data);
-        }
-        return $data ? Json::decode($data) : [];
-    }
-}

+ 0 - 180
common/models/UserStatusAudit.php

@@ -1,180 +0,0 @@
-<?php
-
-namespace common\models;
-
-use backendApi\modules\v1\models\Admin;
-use Yii;
-use common\libs\logging\operate\valueType\Config as ValueTypeConfig;
-
-/**
- * This is the model class for table "{{%USER_STATUS_AUDIT}}".
- *
- * @property string $ID
- * @property string $USER_ID 会员ID
- * @property int $STATUS_VALUE 修改后状态值
- * @property int $ORI_VALUE 原始状态值
- * @property int $PERIOD_NUM 期数
- * @property int $AUDIT_STATUS 审核状态
- * @property string $DEC_LV 修改状态时报单级别
- * @property string $EMP_LV 修改状态时聘级
- * @property string $PV_1L 修改状态时一市场业绩
- * @property string $PV_2L 修改状态时二市场业绩
- * @property string $PV_3L 修改状态时三市场业绩
- * @property string $PV_4L 修改状态时四市场业绩
- * @property string $PV_5L 修改状态时五市场业绩
- * @property string $SURPLUS_1L 修改状态时一市场剩余业绩
- * @property string $SURPLUS_2L 修改状态时二市场剩余业绩
- * @property string $SURPLUS_3L 修改状态时三市场剩余业绩
- * @property string $SURPLUS_4L 修改状态时四市场剩余业绩
- * @property string $SURPLUS_5L 修改状态时五市场剩余业绩
- * @property int $IS_PERIOD_ADD_T 是否按照期数加T
- * @property int $ADD_T_PERIOD_NUM 身份证加T的期数
- * @property int $IS_PERIOD_OPEN 是否按照期数开通
- * @property int $OPEN_PERIOD_NUM 开通期数
- * @property string $CREATE_ADMIN 创建人
- * @property string $AUDIT_ADMIN 审核人
- * @property string $CREATE_REMARK 创建备注
- * @property string $AUDIT_REMARK 审核备注
- * @property int $CREATED_AT 创建时间
- * @property int $AUDITED_AT 审核时间
- */
-class UserStatusAudit extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%USER_STATUS_AUDIT}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['USER_ID', 'PERIOD_NUM', 'CREATE_ADMIN', 'CREATED_AT'], 'required'],
-            [['STATUS_VALUE', 'ORI_VALUE', 'PERIOD_NUM', 'AUDIT_STATUS', 'IS_PERIOD_ADD_T', 'ADD_T_PERIOD_NUM', 'IS_PERIOD_OPEN', 'OPEN_PERIOD_NUM', 'CREATED_AT', 'AUDITED_AT'], 'integer'],
-            [['PV_1L', 'PV_2L', 'PV_3L', 'PV_4L', 'PV_5L', 'SURPLUS_1L', 'SURPLUS_2L', 'SURPLUS_3L', 'SURPLUS_4L', 'SURPLUS_5L'], 'number'],
-            [['ID', 'USER_ID', 'DEC_LV', 'EMP_LV', 'CREATE_ADMIN', 'AUDIT_ADMIN'], 'string', 'max' => 32],
-            [['CREATE_REMARK', 'AUDIT_REMARK'], 'string', 'max' => 4000],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_ID' => '会员ID',
-            'STATUS_VALUE' => '修改后状态值',
-            'ORI_VALUE' => '原始状态值',
-            'PERIOD_NUM' => '期数',
-            'AUDIT_STATUS' => '审核状态',
-            'DEC_LV' => '修改状态时报单级别',
-            'EMP_LV' => '修改状态时聘级',
-            'PV_1L' => '修改状态时一市场业绩',
-            'PV_2L' => '修改状态时二市场业绩',
-            'PV_3L' => '修改状态时三市场业绩',
-            'PV_4L' => '修改状态时四市场业绩',
-            'PV_5L' => '修改状态时五市场业绩',
-            'SURPLUS_1L' => '修改状态时一市场剩余业绩',
-            'SURPLUS_2L' => '修改状态时二市场剩余业绩',
-            'SURPLUS_3L' => '修改状态时三市场剩余业绩',
-            'SURPLUS_4L' => '修改状态时四市场剩余业绩',
-            'SURPLUS_5L' => '修改状态时五市场剩余业绩',
-            'IS_PERIOD_ADD_T' => '是否按照期数加T',
-            'ADD_T_PERIOD_NUM' => '身份证加T的期数',
-            'IS_PERIOD_OPEN' => '是否按照期数开通',
-            'OPEN_PERIOD_NUM' => '开通期数',
-            'CREATE_ADMIN' => '创建人',
-            'AUDIT_ADMIN' => '审核人',
-            'CREATE_REMARK' => '创建备注',
-            'AUDIT_REMARK' => '审核备注',
-            'CREATED_AT' => '创建时间',
-            'AUDITED_AT' => '审核时间',
-        ];
-    }
-
-    /**
-     * 操作日志记录条件
-     * @return array
-     */
-    public function attrLabelsWithLogType(){
-        return [
-            'ID' => 'ID',
-            'USER_ID' => '会员ID',
-            'STATUS_VALUE' => [
-                'label' => '修改后状态值',
-                'type' => ValueTypeConfig::USER_STATUS_TYPE,
-            ],
-            'ORI_VALUE' => [
-                'label' => '原始状态值',
-                'type' => ValueTypeConfig::USER_STATUS_TYPE,
-            ],
-            'PERIOD_NUM' => '期数',
-            'AUDIT_STATUS' => [
-                'label' => '审核状态',
-                'type' => ValueTypeConfig::AUDIT_STATUS_TYPE,
-            ],
-            'DEC_LV' => [
-                'label' => '修改状态时报单级别',
-                'type' => ValueTypeConfig::DEC_LV_TYPE,
-            ],
-            'EMP_LV' => [
-                'label' => '修改状态时聘级',
-                'type' => ValueTypeConfig::EMP_LV_TYPE,
-            ],
-            'PV_1L' => '修改状态时一市场业绩',
-            'PV_2L' => '修改状态时二市场业绩',
-            'PV_3L' => '修改状态时三市场业绩',
-            'PV_4L' => '修改状态时四市场业绩',
-            'PV_5L' => '修改状态时五市场业绩',
-            'SURPLUS_1L' => '修改状态时一市场剩余业绩',
-            'SURPLUS_2L' => '修改状态时二市场剩余业绩',
-            'SURPLUS_3L' => '修改状态时三市场剩余业绩',
-            'SURPLUS_4L' => '修改状态时四市场剩余业绩',
-            'SURPLUS_5L' => '修改状态时五市场剩余业绩',
-            'IS_PERIOD_ADD_T' => [
-                'label' => '是否按照期数加T',
-                'type' => ValueTypeConfig::YES_NO_TYPE,
-            ],
-            'ADD_T_PERIOD_NUM' => '身份证加T的期数',
-            'IS_PERIOD_OPEN' => [
-                'label' => '是否按照期数开通',
-                'type' => ValueTypeConfig::YES_NO_TYPE,
-            ],
-            'OPEN_PERIOD_NUM' => '开通期数',
-            'CREATE_ADMIN' => [
-                'label' => '创建人',
-                'type' => function($data){
-                    $value = $data['value'];
-                    $result = Admin::findOneAsArray('ID=:ID', [':ID'=>$value], 'ADMIN_NAME');
-                    return $result['ADMIN_NAME'];
-                },
-            ],
-            'AUDIT_ADMIN' => [
-                'label' => '审核人',
-                'type' => function($data){
-                    $value = $data['value'];
-                    $result = Admin::findOneAsArray('ID=:ID', [':ID'=>$value], 'ADMIN_NAME');
-                    return $result['ADMIN_NAME'];
-                },
-            ],
-            'CREATE_REMARK' => '创建备注',
-            'AUDIT_REMARK' => '审核备注',
-            'CREATED_AT' => [
-                'label' => '创建时间',
-                'type' => ValueTypeConfig::DATE_TIME_TYPE,
-            ],
-            'AUDITED_AT' => [
-                'label' => '审核时间',
-                'type' => ValueTypeConfig::DATE_TIME_TYPE,
-            ],
-        ];
-    }
-}

+ 0 - 137
common/models/UserTeam.php

@@ -1,137 +0,0 @@
-<?php
-
-namespace common\models;
-
-use common\helpers\Cache;
-use common\helpers\user\Info;
-use Yii;
-
-/**
- * This is the model class for table "{{%USER_TEAM}}".
- *
- * @property string $ID
- * @property string $TEAM_NAME 团队名称
- * @property string $LEADER_UID 领导人ID
- * @property int $PERIOD_NUM 加入时的期数
- * @property int $UPDATE_PERIOD_NUM 修改期数
- * @property string $CREATE_ADMIN 创建人
- * @property string $UPDATE_ADMIN 修改人
- * @property string $CREATE_REMARK 备注
- * @property string $UPDATE_REMARK 备注
- * @property int $IS_DEL 是否删除
- * @property int $CREATED_AT 创建时间
- * @property int $UPDATED_AT 更新时间
- */
-class UserTeam extends \common\components\ActiveRecord {
-    /**
-     * @inheritdoc
-     */
-    public static function tableName() {
-        return '{{%USER_TEAM}}';
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function rules()
-    {
-        return [
-            [['TEAM_NAME', 'LEADER_UID', 'PERIOD_NUM', 'CREATE_ADMIN', 'CREATED_AT'], 'required'],
-            [['PERIOD_NUM', 'UPDATE_PERIOD_NUM', 'IS_DEL', 'CREATED_AT', 'UPDATED_AT'], 'integer'],
-            [['ID', 'TEAM_NAME', 'LEADER_UID', 'CREATE_ADMIN', 'UPDATE_ADMIN'], 'string', 'max' => 32],
-            [['CREATE_REMARK', 'UPDATE_REMARK'], 'string', 'max' => 4000],
-            [['LEADER_UID'], 'unique'],
-            [['TEAM_NAME'], 'unique'],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function attributeLabels() {
-        return [
-            'ID' => 'ID',
-            'TEAM_NAME' => '团队名称',
-            'LEADER_UID' => '领导人ID',
-            'PERIOD_NUM' => '加入时的期数',
-            'UPDATE_PERIOD_NUM' => '修改期数',
-            'CREATE_ADMIN' => '创建人',
-            'UPDATE_ADMIN' => '修改人',
-            'CREATE_REMARK' => '备注',
-            'UPDATE_REMARK' => '备注',
-            'IS_DEL' => '是否删除',
-            'CREATED_AT' => '创建时间',
-            'UPDATED_AT' => '更新时间',
-        ];
-    }
-
-    /**
-     * 获取一个团队
-     * @param $id
-     * @return array|null|\yii\db\ActiveRecord
-     */
-    public static function getTeam($id) {
-        return static::findUseSlaves()->where('ID=:ID', [':ID' => $id])->asArray()->one();
-    }
-
-    /**
-     * 通过会员ID查找团队
-     * @param $userId
-     * @return array|null
-     */
-    public static function getTeamByUserId($userId) {
-        $userInfo = UserInfo::findOneAsArray('USER_ID=:USER_ID', [':USER_ID' => $userId]);
-        return static::findOneAsArray('ID=:ID', [':ID' => $userInfo['TEAM_ID']]);
-    }
-
-    /**
-     * 团队下的所有会员
-     * @param $id
-     * @return array|null
-     */
-    public static function getAllChildren($id) {
-        return UserInfo::findAllAsArray('TEAM_ID=:TEAM_ID', [':TEAM_ID' => $id]);
-    }
-
-    /**
-     * 通过一个团队查找到上级团队领导人
-     * @param $id
-     * @return array|null|\yii\db\ActiveRecord
-     */
-    public static function getParentTeamFromTeam($id) {
-        $oneTeam = static::find()->select('LEADER_UID')->where('ID=:ID', [':ID' => $id])->asArray()->one();
-        return $oneTeam ? self::getPatentTeamLeader($oneTeam['LEADER_UID']) : null;
-    }
-
-
-    /**
-     * 通过一个团队的领导会员获取上级团队
-     * @param $userId
-     * @return array|null
-     */
-    public static function getParentTeam($userId){
-        // 联表查询安置网络的上级UID,并且是领导的会员
-        $isTeamLeaderUser = UserNetwork::find()->select('UN.*,PUI.NETWORK_DEEP,PUI.IS_TEAM_LEADER,PUI.TEAM_ID')->where('UN.USER_ID=:USER_ID AND PUI.IS_TEAM_LEADER=1', [':USER_ID'=>$userId])->from(UserNetwork::tableName().' AS UN')->join('LEFT JOIN', UserInfo::tableName().' AS PUI', 'UN.PARENT_UID=PUI.USER_ID')->orderBy('PUI.NETWORK_DEEP DESC')->limit(1)->asArray()->one();
-        // 拿到团队的ID以后,再查询团队
-        return UserTeam::findOneAsArray('ID=:ID', [':ID'=>$isTeamLeaderUser['TEAM_ID']]);
-    }
-
-    /**
-     * 通过一个团队的领导会员获取上级团队领导UID
-     * @param $userId
-     * @return mixed|null
-     */
-    public static function getPatentTeamLeader($userId) {
-        $team = self::getParentTeam($userId);
-        return $team ? $team['LEADER_UID'] : null;
-    }
-
-    /**
-     * 全部团队
-     * @return array|\yii\db\ActiveRecord[]
-     */
-    public static function getTeamData(){
-        return self::find()->select('ID,TEAM_NAME,LEADER_UID')->where('IS_DEL=0')->orderBy('CREATED_AT ASC')->asArray()->all();
-    }
-}

+ 0 - 117
common/models/UserTeamwork.php

@@ -1,117 +0,0 @@
-<?php
-
-namespace common\models;
-
-use backendApi\modules\v1\models\Admin;
-use common\helpers\user\Info;
-use Yii;
-use common\libs\logging\operate\valueType\Config as ValueTypeConfig;
-
-/**
- * This is the model class for table "{{%USER_TEAMWORK}}".
- *
- * @property string $ID
- * @property string $USER_ID 会员ID
- * @property string $MAIN_UID 主会员ID
- * @property string $DIVIDE_PERCENT 分成比例
- * @property int $PERIOD_NUM 加入时期数
- * @property int $IS_DEL 是否删除
- * @property string $CREATE_ADMIN 创建人
- * @property string $UPDATE_ADMIN 修改人
- * @property string $CREATE_REMARK 创建备注
- * @property string $UPDATE_REMARK 修改备注
- * @property int $CREATED_AT 创建时间
- * @property int $UPDATED_AT 修改时间
- * @property int $UPDATED_PERIOD 修改期数
- * @property int $DELETED_AT 已删除
- */
-class UserTeamwork extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%USER_TEAMWORK}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['USER_ID', 'MAIN_UID', 'PERIOD_NUM', 'CREATE_ADMIN', 'CREATED_AT'], 'required'],
-            [['DIVIDE_PERCENT'], 'number'],
-            [['PERIOD_NUM', 'IS_DEL', 'CREATED_AT', 'UPDATED_AT', 'UPDATED_PERIOD', 'DELETED_AT'], 'integer'],
-            [['ID', 'USER_ID', 'MAIN_UID', 'CREATE_ADMIN', 'UPDATE_ADMIN'], 'string', 'max' => 32],
-            [['CREATE_REMARK', 'UPDATE_REMARK'], 'string', 'max' => 4000],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'USER_ID' => '会员ID',
-            'MAIN_UID' => '主会员ID',
-            'DIVIDE_PERCENT' => '分成比例',
-            'PERIOD_NUM' => '加入时期数',
-            'IS_DEL' => '是否删除',
-            'CREATE_ADMIN' => '创建人',
-            'UPDATE_ADMIN' => '修改人',
-            'CREATE_REMARK' => '创建备注',
-            'UPDATE_REMARK' => '修改备注',
-            'CREATED_AT' => '创建时间',
-            'UPDATED_AT' => '修改时间',
-            'UPDATED_PERIOD' => '修改期数',
-            'DELETED_AT' => '已删除',
-        ];
-    }
-
-    /**
-     * 操作日志记录条件
-     * @return array
-     */
-    public function attrLabelsWithLogType(){
-        return [
-            'USER_ID' => '会员ID',
-            'MAIN_UID' => [
-                'label' => '主会员编号',
-                'type' => function($data){
-                    $value = $data['value'];
-                    return Info::getUserNameByUserId($value);
-                },
-            ],
-            'DIVIDE_PERCENT' => '分成比例',
-            'CREATE_ADMIN' => [
-                'label' => '操作人',
-                'type' => function($data){
-                    $value = $data['value'];
-                    $result = Admin::findOneAsArray('ID=:ID', [':ID'=>$value], 'ADMIN_NAME');
-                    return $result['ADMIN_NAME'];
-                },
-            ],
-            'UPDATE_ADMIN' => [
-                'label' => '修改人',
-                'type' => function($data){
-                    $value = $data['value'];
-                    $result = Admin::findOneAsArray('ID=:ID', [':ID'=>$value], 'ADMIN_NAME');
-                    return $result['ADMIN_NAME'];
-                },
-            ],
-            'CREATED_AT' => [
-                'label' => '操作时间',
-                'type' => ValueTypeConfig::DATE_TIME_TYPE,
-            ],
-            'UPDATED_AT' => [
-                'label' => '修改时间',
-                'type' => ValueTypeConfig::DATE_TIME_TYPE,
-            ],
-        ];
-    }
-}

+ 0 - 402
common/models/Withdraw.php

@@ -1,402 +0,0 @@
-<?php
-
-namespace common\models;
-
-use common\helpers\Cache;
-use common\helpers\Date;
-use common\helpers\Tool;
-use common\helpers\user\Info;
-use Yii;
-
-/**
- * This is the model class for table "{{%WITHDRAW}}".
- *
- * @property string $ID
- * @property string $SN 单号
- * @property string $USER_ID 会员ID
- * @property string $ID_CARD 身份证号
- * @property int $WITHDRAW_PERIOD_NUM 提现期数
- * @property int $WITHDRAW_YEAR 提现年份
- * @property int $WITHDRAW_MONTH 提现月份
- * @property int $PAY_TYPE 付款类型
- * @property int $IS_AUTO_WITHDRAW 是否自动提现
- * @property string $AMOUNT 提现金额
- * @property string $FEES 提现手续费
- * @property string $REAL_AMOUNT 实际提现金额
- * @property string $INVOICE_ID 发票ID
- * @property string $REAL_NAME 会员姓名
- * @property string $OPEN_BANK 开户行
- * @property string $BANK_ADDRESS 银行地址
- * @property string $BANK_NO 银行账号
- * @property int $BANK_PROVINCE 银行省份
- * @property int $BANK_CITY 银行城市
- * @property int $BANK_COUNTY 银行地区
- * @property string $P_MONTH 表分区标识
- * @property int $AUDIT_STATUS 审核状态
- * @property string $REMARK 备注
- * @property string $UPDATE_ADMIN 修改管理员
- * @property string $UPDATE_REMARK 修改备注
- * @property string $AUDIT_ADMIN 审核管理员
- * @property int $CREATED_AT 创建时间
- * @property int $UPDATED_AT 修改时间
- * @property int $AUDITED_AT 审核时间
- * @property int $PLAN_PAID_AT 预计付款时间
- * @property int $PAID_AT 付款时间
- * @property string $PAID_FAIL_REMARK 付款失败备注
- * @property int $PAID_FAIL_AT 付款失败时间
- * @property string $BACK_REMARK 提现退回备注
- * @property int $BACK_FAIL_AT 提现退回时间
- */
-class Withdraw extends \common\components\ActiveRecord {
-    const TYPE_MANUAL = 0;      // 手动提现
-    const TYPE_AUTO = 1;        // 自动提现
-    const TYPE_ADMIN = 2;       // 后台管理员
-
-    //付款类型
-    const PAY_TYPE_NO_INVOICE = 0;
-    const PAY_TYPE_NEED_INVOICE = 1;
-
-    const STATUS_APPLIED = 0;       // 已申请
-//    const STATUS_INVOICED = 1;      // 已传票
-    const STATUS_AUDITED = 2;       // 已审核
-    const STATUS_WAIT_PAID = 3;     // 待付款
-    const STATUS_PAID_FALSE = 4;    // 付款失败
-    const STATUS_REFUSED = 5;       // 已拒绝
-    const STATUS_PAID = 6;          // 已付款
-    const STATUS_RETURN = 7;        // 提现退回
-
-    const STATUS_NAME = [
-        self::STATUS_APPLIED => '提现待审核',
-//        self::STATUS_INVOICED => '提现待审核',
-        self::STATUS_AUDITED => '提现已审核',
-        self::STATUS_WAIT_PAID => '提现待付款',
-        self::STATUS_PAID_FALSE => '付款失败',
-        self::STATUS_REFUSED => '已拒绝',
-        self::STATUS_PAID => '提现已付款',
-        self::STATUS_RETURN => '已退回',
-    ];
-
-    /**
-     * @inheritdoc
-     */
-    public static function tableName() {
-        return '{{%WITHDRAW}}';
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function rules() {
-        return [
-            [['USER_ID', 'P_MONTH', 'CREATED_AT', 'PLAN_PAID_AT'], 'required'],
-            [['WITHDRAW_PERIOD_NUM', 'WITHDRAW_YEAR', 'WITHDRAW_MONTH', 'IS_AUTO_WITHDRAW', 'BANK_PROVINCE', 'BANK_CITY', 'BANK_COUNTY', 'AUDIT_STATUS', 'CREATED_AT', 'UPDATED_AT', 'AUDITED_AT', 'PLAN_PAID_AT', 'PAID_AT', 'PAID_FAIL_AT', 'BACK_FAIL_AT', 'PAY_TYPE'], 'integer'],
-            [['AMOUNT','FEES','REAL_AMOUNT'], 'number'],
-            [['ID', 'SN', 'USER_ID', 'INVOICE_ID', 'OPEN_BANK', 'BANK_NO', 'UPDATE_ADMIN', 'AUDIT_ADMIN'], 'string', 'max' => 32],
-            [['ID_CARD'], 'string', 'max' => 20],
-            [['REAL_NAME', 'BANK_ADDRESS'], 'string', 'max' => 255],
-            [['REMARK', 'UPDATE_REMARK', 'PAID_FAIL_REMARK', 'BACK_REMARK'], 'string', 'max' => 4000],
-            [['ID'], 'unique'],
-            [['SN'], 'unique'],
-        ];
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function attributeLabels() {
-        return [
-            'ID' => 'ID',
-            'SN' => '单号',
-            'USER_ID' => '会员ID',
-            'ID_CARD' => '身份证号',
-            'WITHDRAW_PERIOD_NUM' => '提现期数',
-            'WITHDRAW_YEAR' => '提现年份',
-            'WITHDRAW_MONTH' => '提现月份',
-            'PAY_TYPE' => '付款类型',
-            'IS_AUTO_WITHDRAW' => '是否自动提现',
-            'AMOUNT' => '提现金额',
-            'FEES' => '提现手续费',
-            'REAL_AMOUNT' => '实际提现金额',
-            'INVOICE_ID' => '发票ID',
-            'REAL_NAME' => '会员姓名',
-            'OPEN_BANK' => '开户行',
-            'BANK_ADDRESS' => '银行地址',
-            'BANK_NO' => '银行账号',
-            'BANK_PROVINCE' => '银行省份',
-            'BANK_CITY' => '银行城市',
-            'BANK_COUNTY' => '银行地区',
-            'P_MONTH' => '表分区标识',
-            'AUDIT_STATUS' => '审核状态',
-            'REMARK' => '备注',
-            'UPDATE_ADMIN' => '修改管理员',
-            'UPDATE_REMARK' => '修改备注',
-            'AUDIT_ADMIN' => '审核管理员',
-            'CREATED_AT' => '创建时间',
-            'UPDATED_AT' => '修改时间',
-            'AUDITED_AT' => '审核时间',
-            'PLAN_PAID_AT' => '预计付款时间',
-            'PAID_AT' => '付款时间',
-            'PAID_FAIL_REMARK' => '付款失败备注',
-            'PAID_FAIL_AT' => '付款失败时间',
-            'BACK_REMARK' => '提现退回备注',
-            'BACK_FAIL_AT' => '提现退回时间',
-        ];
-    }
-
-    /**
-     * @return \yii\db\ActiveQuery
-     */
-    public function getOpenBank() {
-        return $this->hasOne(OpenBank::class, ['BANK_CODE' => 'BANK_CODE']);
-    }
-
-    /**
-     * 获取提现相关期数,目前按照直接取当月第一期来实现
-     * @param $nowTime
-     * @return array
-     */
-    public static function getPeriod($nowTime) {
-        $period = Period::instance();
-        $year = $period->getNowYear();
-        $month = $period->getNowMonth();
-        $yearMonth = $period->getNowYearMonth();
-        $thisMonth = Period::getPeriodNumRangeFromMonth($year, $month);
-        $period->setPeriodNum($thisMonth['min']);
-        $endTime = $period->getNowPeriodEnd();
-        return ['nowPeriodNum' => $thisMonth['min'], 'nowYear' => $year, 'nowMonth' => $month, 'yearMonth'=>$yearMonth, 'endTime' => $endTime];
-    }
-
-    /**
-     * 是否存在待审核的提现
-     * @param $userId
-     * @return bool
-     */
-    public static function existWaitAudit($userId) {
-        $noTwiceWithdraw = [self::STATUS_APPLIED, self::STATUS_WAIT_PAID, self::STATUS_PAID_FALSE];
-        $noTwiceWithdrawStr = implode("','", $noTwiceWithdraw);
-        $noTwiceWithdrawStr = "'" . $noTwiceWithdrawStr . "'";
-        if ($status = static::findOneAsArray('USER_ID=:USER_ID AND AUDIT_STATUS IN (' . $noTwiceWithdrawStr . ')', [':USER_ID' => $userId], 'AUDIT_STATUS')) {
-            return self::STATUS_NAME[$status['AUDIT_STATUS']];
-        } else {
-            return '';
-        }
-    }
-
-    /**
-     * 会员本月是否提现
-     * @param $uid
-     * @return bool
-     */
-    public static function hasThisMonthWithdraw($uid) {
-        $period = Period::instance();
-        $idCard = Info::getIdCardByUserId($uid);
-        if ($idCard) {
-            if (static::find()->where('ID_CARD=:ID_CARD AND WITHDRAW_YEAR=:WITHDRAW_YEAR AND WITHDRAW_MONTH=:WITHDRAW_MONTH AND AUDIT_STATUS!=:AUDIT_STATUS', [':ID_CARD' => $idCard, ':WITHDRAW_YEAR' => $period->getNowYear(), ':WITHDRAW_MONTH' => $period->getNowMonth(), ':AUDIT_STATUS' => self::STATUS_RETURN])->exists()) {
-                return true;
-            }
-        } else {
-            if (static::find()->where('USER_ID=:USER_ID AND WITHDRAW_YEAR=:WITHDRAW_YEAR AND WITHDRAW_MONTH=:WITHDRAW_MONTH AND AUDIT_STATUS!=:AUDIT_STATUS', [':USER_ID' => $uid, ':WITHDRAW_YEAR' => $period->getNowYear(), ':WITHDRAW_MONTH' => $period->getNowMonth(), ':AUDIT_STATUS' => self::STATUS_RETURN])->exists()) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * 是否可提现
-     * @return bool
-     */
-    public static function allowWithdraw() {
-        return true;//@todo 上线时删除
-        $period = Period::instance();
-        $year = $period->getNowYear();
-        $month = $period->getNowMonth();
-        $thisMonth = Period::getPeriodNumRangeFromMonth($year, $month);
-        $periodNum = $period->getNowPeriodNum();
-
-        if ($periodNum == $thisMonth['min']) {
-            //上月是否已挂网
-            $lastMonth = $period->getLastMonth();
-            $lastPeriodPoint = Period::getPeriodPointFromMonth($lastMonth['year'], $lastMonth['month']);
-            if ($lastPeriodPoint && $lastPeriodPoint['SENT_AT'] > 0 && Date::nowTime() > $lastPeriodPoint['SENT_AT']) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * 是否到了自动期限的日期
-     * @return bool
-     */
-    public static function allowAutoWithdraw() {
-        $period = Period::instance();
-        $year = $period->getNowYear();
-        $month = $period->getNowMonth();
-        $thisMonth = Period::getPeriodNumsFromMonth($year, $month);
-        $periodNum = $period->getNowPeriodNum();
-        //结算月第一周封期后
-        if ($periodNum == $thisMonth[1]['PERIOD_NUM']) {
-            //上月是否已挂网
-            $lastMonth = $period->getLastMonth();
-            $lastPeriodPoint = Period::getPeriodPointFromMonth($lastMonth['year'], $lastMonth['month']);
-            if ($lastPeriodPoint && $lastPeriodPoint['SENT_AT'] > 0 && Date::nowTime() > $lastPeriodPoint['SENT_AT']) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * 获取本月提现金额
-     * @param $uid
-     * @return string
-     */
-    public static function getThisMonthWithdraw($uid) {
-        $period = Period::instance();
-        $withdraw = static::find()->select('SUM(AMOUNT) AS sums')->where('USER_ID=:USER_ID AND WITHDRAW_YEAR=:WITHDRAW_YEAR AND WITHDRAW_MONTH=:WITHDRAW_MONTH', [':USER_ID' => $uid, ':WITHDRAW_YEAR' => $period->getNowYear(), ':WITHDRAW_MONTH' => $period->getNowMonth()])->asArray()->one();
-        return tool::formatPrice($withdraw['sums'] ? $withdraw['sums'] : 0);
-    }
-
-    /**
-     * 获取本年提现金额
-     * @param $uid
-     * @return string
-     */
-    public static function getThisYearWithdraw($uid) {
-        $period = Period::instance();
-        $withdraw = static::find()->select('SUM(AMOUNT) AS sums')->where('USER_ID=:USER_ID AND WITHDRAW_YEAR=:WITHDRAW_YEAR', [':USER_ID' => $uid, ':WITHDRAW_YEAR' => $period->getNowYear()])->asArray()->one();
-        return tool::formatPrice($withdraw['sums'] ? $withdraw['sums'] : 0);
-    }
-
-
-    /**
-     * 调整会员的自动提现状态
-     * @param $userId
-     * @param int $isAuto
-     */
-    public static function setAutoWithdraw($userId, $isAuto = 1) {
-        UserInfo::updateAll(['IS_AUTO_WITHDRAW' => $isAuto], 'USER_ID=:USER_ID', [':USER_ID' => $userId]);
-    }
-
-    /**
-     * 银行信息
-     * @param $row
-     * @param $baseInfo
-     * @return array
-     */
-    public static function getBankInfo($row, $baseInfo) {
-        $regionConfig = Cache::getRegionConfig();
-        $data = ['REAL_NAME' => '', 'OPEN_BANK' => '', 'BANK_PROVINCE' => '', 'BANK_CITY' => '', 'BANK_COUNTY' => '', 'BANK_ADDRESS' => '', 'BANK_NO' => '', 'BANK_UPDATED_AT' => $baseInfo['BANK_UPDATED_AT']];
-        if ($row['AUDIT_STATUS'] == self::STATUS_PAID) {
-            $data['REAL_NAME'] = $row['REAL_NAME'];
-            $data['OPEN_BANK'] = $row['OPEN_BANK'];
-            $data['BANK_PROVINCE'] = $row['BANK_PROVINCE'];
-            $data['BANK_CITY'] = $row['BANK_CITY'];
-            $data['BANK_COUNTY'] = $row['BANK_COUNTY'];
-            $data['BANK_ADDRESS'] = $row['BANK_ADDRESS'];
-            $data['BANK_NO'] = $row['BANK_NO'];
-
-        } else {
-            //公司
-            if ($row['REG_TYPE'] == '758BF69C25C3422AA7743936BC77EE64') {
-                $companyBank = CompanyBank::findOneAsArray('USER_ID=:USER_ID', [':USER_ID' => $row['USER_ID']]);
-                $data['REAL_NAME'] = $companyBank['OPEN_NAME'];
-                $data['OPEN_BANK'] = $companyBank['OPEN_BANK'];
-                $data['BANK_PROVINCE'] = $companyBank['BANK_PROVINCE'];
-                $data['BANK_CITY'] = $companyBank['BANK_CITY'];
-                $data['BANK_COUNTY'] = $companyBank['BANK_COUNTY'];
-                $data['BANK_ADDRESS'] = $companyBank['BANK_ADDRESS'];
-                $data['BANK_NO'] = $companyBank['BANK_NO'];
-                $data['BANK_UPDATED_AT'] = $companyBank['UPDATED_AT'];
-            } else {
-                $data['REAL_NAME'] = $baseInfo['REAL_NAME'];
-                $data['OPEN_BANK'] = $baseInfo['OPEN_BANK'];
-                $data['BANK_PROVINCE'] = $baseInfo['BANK_PROVINCE'];
-                $data['BANK_CITY'] = $baseInfo['BANK_CITY'];
-                $data['BANK_COUNTY'] = $baseInfo['BANK_COUNTY'];
-                $data['BANK_ADDRESS'] = $baseInfo['BANK_ADDRESS'];
-                $data['BANK_NO'] = $baseInfo['BANK_NO'];
-            }
-        }
-        $data['BANK_PROVINCE_NAME'] = $baseInfo['BANK_PROVINCE'] ? $regionConfig[$baseInfo['BANK_PROVINCE']]['REGION_NAME'] : '';
-        $data['BANK_CITY_NAME'] = $baseInfo['BANK_CITY'] ? $regionConfig[$baseInfo['BANK_CITY']]['REGION_NAME'] : '';
-        $data['BANK_COUNTY_NAME'] = $baseInfo['BANK_COUNTY'] ? $regionConfig[$baseInfo['BANK_COUNTY']]['REGION_NAME'] : '';
-        $data['OPEN_BANK_NAME'] = $baseInfo['OPEN_BANK'] ? OpenBank::getCnName($baseInfo['OPEN_BANK']) : '';
-        return $data;
-    }
-
-    /**
-     * 判断提现状态
-     * @param $sn
-     * @param $nowStatus
-     * @param $toStatus
-     * @return string
-     */
-    public static function chkAuditStatus($sn, $nowStatus, $toStatus) {
-        $statusName = self::STATUS_NAME;
-        $msg = '提现单' . $sn . '当前状态为【' . $statusName[$nowStatus] . '】,无法设置为【' . $statusName[$toStatus] . '】';
-        switch ($toStatus) {
-            //已审核
-            case Withdraw::STATUS_AUDITED:
-                if ($nowStatus == Withdraw::STATUS_APPLIED) {
-                    $msg = '';
-                }
-                break;
-            //待付款
-            case Withdraw::STATUS_WAIT_PAID:
-                if ($nowStatus == Withdraw::STATUS_AUDITED || $nowStatus == Withdraw::STATUS_PAID_FALSE) {
-                    $msg = '';
-                }
-                break;
-            //已付款
-            case Withdraw::STATUS_PAID:
-                if ($nowStatus == Withdraw::STATUS_WAIT_PAID) {
-                    $msg = '';
-                }
-                break;
-            //付款失败
-            case Withdraw::STATUS_PAID_FALSE:
-                if ($nowStatus == Withdraw::STATUS_PAID) {
-                    $msg = '';
-                }
-                break;
-            //提现退回
-            case Withdraw::STATUS_RETURN:
-                if ($nowStatus == Withdraw::STATUS_APPLIED  || $nowStatus == Withdraw::STATUS_AUDITED || Withdraw::STATUS_WAIT_PAID) {
-                    $msg = '';
-                }
-                break;
-            //审核拒绝
-            case Withdraw::STATUS_REFUSED:
-                if ($nowStatus == Withdraw::STATUS_APPLIED) {
-                    $msg = '';
-                }
-                break;
-            default:
-        }
-        return $msg;
-    }
-
-    /**
-     * 按提现状态返回总和
-     * @param $userId
-     * @param int $type
-     * @return mixed
-     */
-    public static function getWithdrawTotal($userId, $type = self::STATUS_PAID) {
-        $total = self::find()->where('USER_ID=:USER_ID AND AUDIT_STATUS=:AUDIT_STATUS', [':USER_ID' => $userId, ':AUDIT_STATUS' => $type])->sum('AMOUNT');
-        return $total ? $total : '0.00';
-    }
-
-    /**
-     * 按提现状态返回所有会员总和
-     * @param int $type
-     * @return mixed
-     */
-    public static function getAllWithdrawTotal($type = self::STATUS_PAID) {
-        $total = self::find()->where('AUDIT_STATUS=:AUDIT_STATUS', [':AUDIT_STATUS' => $type])->sum('AMOUNT');
-        return $total ? $total : '0.00';
-    }
-
-}

+ 0 - 81
common/models/WithdrawLevel.php

@@ -1,81 +0,0 @@
-<?php
-
-namespace common\models;
-
-use common\helpers\Cache;
-use Yii;
-
-/**
- * This is the model class for table "{{%WITHDRAW_LEVEL}}".
- *
- * @property string $ID
- * @property string $TYPE 注册类型
- * @property string $MIN_AMOUNT 最小金额
- * @property string $MAX_AMOUNT 最大金额
- * @property string $TAX_PERCENT 税金比率
- * @property int $CREATED_AT 创建时间
- */
-class WithdrawLevel extends \common\components\ActiveRecord
-{
-    /**
-     * @inheritdoc
-     */
-    public static function tableName()
-    {
-        return '{{%WITHDRAW_LEVEL}}';
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function rules()
-    {
-        return [
-            [['TYPE', 'CREATED_AT'], 'required'],
-            [['MIN_AMOUNT', 'MAX_AMOUNT', 'TAX_PERCENT'], 'number'],
-            [['CREATED_AT'], 'integer'],
-            [['ID', 'TYPE'], 'string', 'max' => 32],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'TYPE' => '注册类型',
-            'MIN_AMOUNT' => '最小金额',
-            'MAX_AMOUNT' => '最大金额',
-            'TAX_PERCENT' => '税金比率',
-            'CREATED_AT' => '创建时间',
-        ];
-    }
-
-    /**
-     * 从缓存获取信息
-     * @return array|mixed|\yii\db\ActiveRecord[]
-     */
-    public static function getFromCache(){
-        $data = Yii::$app->cache->get(Cache::WITHDRAW_LEVEL_CONFIG_KEY);
-        if(!$data){
-            // 获取信息
-            $data = static::find()->where('1=1')->orderBy('MIN_AMOUNT ASC')->asArray()->all();
-            Yii::$app->cache->set(Cache::WITHDRAW_LEVEL_CONFIG_KEY, $data);
-        }
-        return $data;
-    }
-
-    /**
-     *  更新缓存
-     * @return array|\yii\db\ActiveRecord[]
-     */
-    public static function updateToCache(){
-        // 获取配置
-        $data = static::find()->where('1=1')->orderBy('MIN_AMOUNT ASC')->asArray()->all();
-        Yii::$app->cache->set(Cache::WITHDRAW_LEVEL_CONFIG_KEY, $data);
-        return $data;
-    }
-}