| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- <?php
- namespace common\models;
- use backendApi\modules\v1\models\Admin;
- use common\helpers\Tool;
- use common\helpers\user\Info;
- use Yii;
- use common\libs\logging\operate\valueType\Config as ValueTypeConfig;
- /**
- * This is the model class for table "{{%BALANCE_AUDIT}}".
- *
- * @property string $ID
- * @property string $USER_ID 会员ID
- * @property string $LAST_DEC_LV 申请时会员级别
- * @property string $LAST_EMP_LV 申请时会员聘级
- * @property string $LAST_DEC_ROLE_ID 申请时报单中心级别
- * @property string $TYPE 余额类型
- * @property string $DEAL_TYPE 交易类型
- * @property string $AMOUNT 金额
- * @property int $AUDIT_STATUS 状态
- * @property string $UPDATE_ADMIN_ID 变更管理员
- * @property string $AUDIT_ADMIN_ID 审核管理员
- * @property string $CREATE_REMARK 创建备注
- * @property string $AUDIT_REMARK 审核备注
- * @property int $REMARK_IS_SHOW 前台是否展示
- * @property int $CREATED_AT 创建时间
- * @property int $AUDITED_AT 审核时间
- */
- class BalanceAudit extends \common\components\ActiveRecord
- {
- const TYPE = [
- 'bonus' => [
- 'name' => 'bonus',
- 'label' => 'Member bonus account',//会员账户奖金
- ],
- 'cash' => [
- 'name' => 'cash',
- 'label' => 'Member Ecoin account',// 会员账户余额
- ],
- ];
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return '{{%BALANCE_AUDIT}}';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['USER_ID', 'TYPE', 'DEAL_TYPE', 'CREATED_AT'], 'required'],
- [['AMOUNT'], 'number'],
- [['AUDIT_STATUS', 'REMARK_IS_SHOW', 'CREATED_AT', 'AUDITED_AT'], 'integer'],
- [['ID', 'USER_ID', 'LAST_DEC_LV', 'LAST_EMP_LV', 'LAST_DEC_ROLE_ID', 'DEAL_TYPE', 'UPDATE_ADMIN_ID', 'AUDIT_ADMIN_ID'], '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',
- 'LAST_DEC_LV' => '申请时会员级别',
- 'LAST_EMP_LV' => '申请时会员聘级',
- 'LAST_DEC_ROLE_ID' => '申请时报单中心级别',
- 'TYPE' => '余额类型',
- 'DEAL_TYPE' => '交易类型',
- 'AMOUNT' => '金额',
- 'AUDIT_STATUS' => '状态',
- 'UPDATE_ADMIN_ID' => '变更管理员',
- 'AUDIT_ADMIN_ID' => '审核管理员',
- 'CREATE_REMARK' => '创建备注',
- 'AUDIT_REMARK' => '审核备注',
- 'REMARK_IS_SHOW' => '前台是否展示',
- 'CREATED_AT' => '创建时间',
- 'AUDITED_AT' => ' 审核时间',
- ];
- }
- /**
- * 操作日志记录条件
- * @return array
- */
- public function attrLabelsWithLogType(){
- return [
- 'USER_ID' => '会员ID',
- 'TYPE' => [
- 'label' => '余额类型',
- 'type' => function($data){
- $value = $data['value'];
- return Tool::paramConvert(\Yii::$app->params['bonusWalletType'])[$value]['label'];
- },
- ],
- 'DEAL_TYPE' => [
- 'label' => '交易类型',
- 'type' => function($data){
- $value = $data['value'];
- $dealType = DealType::findOneAsArray('ID=:ID', [':ID'=>$value], 'TYPE_NAME');
- return $dealType['TYPE_NAME'];
- },
- ],
- 'AMOUNT' => '金额',
- 'AUDIT_STATUS' => [
- 'label' => '审核状态',
- 'type' => ValueTypeConfig::AUDIT_STATUS_TYPE,
- ],
- 'UPDATE_ADMIN_ID' => [
- 'label' => '变更管理员',
- 'type' => function($data){
- $value = is_array($data) && isset($data['value']) ? $data['value'] : '';
- $result = Admin::findOneAsArray('ID=:ID', [':ID'=>$value], 'ADMIN_NAME');
- return !empty($result) ? $result['ADMIN_NAME'] : '';
- },
- ],
- 'AUDIT_ADMIN_ID' => [
- 'label' => '审核管理员',
- 'type' => function($data){
- $value = is_array($data) && isset($data['value']) ? $data['value'] : '';
- $result = Admin::findOneAsArray('ID=:ID', [':ID'=>$value], 'ADMIN_NAME');
- return !empty($result) ? $result['ADMIN_NAME'] : '';
- },
- ],
- 'CREATE_REMARK' => '备注',
- 'REMARK_IS_SHOW' => [
- 'label' => '前台是否显示备注',
- 'type' => ValueTypeConfig::YES_NO_TYPE,
- ],
- 'CREATED_AT' => [
- 'label' => '创建时间',
- 'type' => ValueTypeConfig::DATE_TIME_TYPE,
- ],
- 'AUDITED_AT' => [
- 'label' => '审核时间',
- 'type' => ValueTypeConfig::DATE_TIME_TYPE,
- ],
- ];
- }
- public static function getBalanceAuditType() {
- return [
- 'bonus' => [
- 'name' => 'bonus',
- 'label' => \Yii::t('ctx', 'balanceAuditListGetBalanceAuditType'),//会员账户奖金
- ],
- 'cash' => [
- 'name' => 'cash',
- 'label' => \Yii::t('ctx', 'balanceAuditListCash'),// 会员账户余额
- ],
- // 'prp' => [
- // 'name' => 'user_performance',
- // 'label' => \Yii::t('ctx', 'balanceAuditListPrp'),// 绩效奖金
- // ],
- ];
- }
- }
|