'待审核', 1 => '审核不通过', 2 => '已修改', ]; /** * @inheritdoc */ public static function tableName() { return 'crm_transfer'; } /** * @return \yii\db\Connection the database connection used by this AR class. */ public static function getDb() { return Yii::$app->get('dbXcrm'); } /** * @inheritdoc */ public function rules() { return [ [['type', 'member_id', 'from_login', 'to_login', 'amount', 'in_time'], 'required'], [['type', 'member_id', 'from_login', 'to_login', 'in_time'], 'integer'], [['amount'], 'number'], [['memo', 'admin_name'], 'string', 'max' => 255], ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'id' => '主键ID', 'type' => '状态(0:等待审核;1:不通过;2:已转账)', 'member_id' => '代理商ID', 'from_login' => '转出账户', 'to_login' => '转入账户', 'amount' => '金额', 'in_time' => '创建时间', 'memo' => '备注', 'admin_name' => '操作人', ]; } /** * 同名转账数量 * @param int $type 0等待审核,1审核不通过,2已修改 * @return int */ public static function countByType($type) { if (!is_numeric($type)) { return 0; } return static::find()->where(['type' => $type])->count(); } }