| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- namespace backend\models;
- use Yii;
- /**
- * This is the model class for table "crm_member".
- *
- * @property integer $id
- * @property integer $login
- * @property integer $member_id
- * @property string $name
- * @property integer is_commission_run
- * @property integer in_time
- */
- class UserMember extends \yii\db\ActiveRecord
- {
-
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return 'crm_user_member';
- }
- /**
- * @return \yii\db\Connection the database connection used by this AR class.
- */
- public static function getDb()
- {
- return Yii::$app->get('dbXcrm');
- }
-
- /**
- * 直客数
- * @param int $member_id
- * @return int
- */
- public static function directlyUserCount($member_id)
- {
- return self::find()->where(['member_id' => $member_id])->count();
- }
- /**
- * @param int $login
- * @return null|static
- */
- public static function findByLogin($login)
- {
- return static::find()->where(['login' => $login])->limit(1)->one();
- }
- }
|