| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <?php
- namespace backend\models;
- use Yii;
- /**
- * This is the model class for table "crm_transfer".
- *
- * @property integer $id
- * @property integer $type
- * @property integer $member_id
- * @property integer $from_login
- * @property integer $to_login
- * @property string $amount
- * @property integer $in_time
- * @property string $memo
- * @property string $admin_name
- */
- class Transfer extends \yii\db\ActiveRecord
- {
- /**
- * @var array
- */
- public static $typeTextMap = [
- 0 => '待审核',
- 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();
- }
- }
|