/**
  * The default implementation returns the names of the columns whose values have been populated into MessageTemplate.
  */
 public function fields()
 {
     return array_merge(parent::fields(), ['id' => function ($model) {
         return (string) $model->_id;
     }, 'name', 'weChat', 'email', 'mobile', 'useWebhook', 'updatedAt' => function ($model) {
         return MongodbUtil::MongoDate2String($model->updatedAt);
     }]);
 }
Example #2
0
 public function fields()
 {
     return array_merge(parent::fields(), ['creator', 'action', 'description', 'createdAt' => function ($model) {
         return MongodbUtil::MongoDate2msTimeStamp($model['createdAt']);
     }, 'issueId' => function ($model) {
         return $model['issueId'] . '';
     }]);
 }
Example #3
0
 /**
  * The default implementation returns the names of the columns whose values have been populated into question.
  */
 public function fields()
 {
     return array_merge(parent::fields(), ['title', 'type', 'options' => function () {
         return empty($this->options) ? [] : $this->options;
     }, 'createdAt' => function () {
         return MongodbUtil::MongoDate2String($this->createdAt, 'Y-m-d H:i:s');
     }, 'order']);
 }
 /**
  * The default implementation returns the names of the columns whose values have been populated into statsCouponLogDaily.
  */
 public function fields()
 {
     return array_merge(parent::fields(), ['couponId', 'recievedNum', 'redeemedNum', 'date' => function () {
         return MongodbUtil::MongoDate2String($this->date);
     }, 'createdAt' => function () {
         return MongodbUtil::MongoDate2String($this->createdAt);
     }]);
 }
Example #5
0
 /**
  * The default implementation returns the names of the columns whose values have been populated into memberLogs.
  */
 public function fields()
 {
     return array_merge(parent::fields(), ['memberId', 'operation', 'operationAt' => function ($model) {
         return MongodbUtil::MongoDate2String($model->operationAt);
     }, 'createdAt' => function ($model) {
         return MongodbUtil::MongoDate2String($model->createdAt);
     }]);
 }
Example #6
0
 /**
  * The default implementation returns the names of the columns whose values have been populated into tradeRefund.
  */
 public function fields()
 {
     return array_merge(parent::fields(), ['refundNumber', 'subject', 'transactionId', 'user', 'refundAccount', 'admin' => function () {
         $admin = $this->admin;
         if (isset($admin['id'])) {
             $admin['id'] = (string) $admin['id'];
         }
         return $admin;
     }, 'expectedAmount', 'realAmount', 'refundMode', 'comments', 'orderNumber', 'createdAt' => function () {
         return MongodbUtil::MongoDate2String($this->createdAt, 'Y-m-d H:i:s');
     }, 'refundAt' => function () {
         return MongodbUtil::MongoDate2String($this->refundAt, 'Y-m-d H:i:s');
     }]);
 }
Example #7
0
 /**
  * The default implementation returns the names of the columns whose values have been populated into Notification.
  */
 public function fields()
 {
     return array_merge(parent::fields(), ['title', 'content', 'isRead', 'status', 'sender' => function ($model) {
         return ['id' => empty($model->sender['id']) ? '' : (string) $model->sender['id'], 'from' => empty($model->sender['from']) ? '' : $model->sender['from']];
     }, 'to' => function ($model) {
         return ['id' => empty($model->to['id']) ? '' : (string) $model->to['id'], 'target' => empty($model->to['target']) ? '' : $model->to['target']];
     }, 'accountId' => function ($model) {
         return (string) $model->accountId;
     }, 'createdAt' => function ($model) {
         return MongodbUtil::MongoDate2String($model->createdAt, 'Y-m-d H:i:s');
     }, 'readAt' => function ($model) {
         return MongodbUtil::MongoDate2String($model->readAt, 'Y-m-d H:i:s');
     }]);
 }
 /**
  * The default implementation returns the names of the columns whose values have been populated into GoodsExchangeLog.
  */
 public function fields()
 {
     return array_merge(parent::fields(), ['goods' => function () {
         $goods = $this->goods;
         foreach ($goods as &$item) {
             $item['id'] = (string) $item['id'];
             $item['productId'] = (string) $item['productId'];
         }
         return $goods;
     }, 'memberId' => function () {
         return (string) $this->memberId;
     }, 'createdAt' => function () {
         return MongodbUtil::MongoDate2String($this->createdAt, 'Y-m-d H:i:s');
     }, 'memberName', 'telephone', 'usedScore', 'count', 'usedFrom', 'expectedScore', 'address', 'postcode', 'isDelivered', 'receiveMode']);
 }
Example #9
0
 /**
  * The default implementation returns the names of the columns whose values have been populated into questionnaire.
  */
 public function fields()
 {
     return array_merge(parent::fields(), ['name', 'startTime' => function () {
         return MongodbUtil::MongoDate2String($this->startTime, 'Y-m-d H:i:s');
     }, 'endTime' => function () {
         return MongodbUtil::MongoDate2String($this->endTime, 'Y-m-d H:i:s');
     }, 'creator' => function ($model) {
         $creator = $model->creator;
         $creator['id'] .= '';
         return $creator;
     }, 'description', 'questions' => function () {
         return self::getByOrder($this->questions);
     }, 'isPublished', 'createdAt' => function () {
         return MongodbUtil::MongoDate2String($this->createdAt, 'Y-m-d H:i:s');
     }]);
 }
Example #10
0
 /**
  * The default implementation returns the names of the columns whose values have been populated into couponLog.
  */
 public function fields()
 {
     return array_merge(parent::fields(), ['couponId' => function () {
         $couponId = (string) $this->couponId;
         return $couponId;
     }, 'membershipDiscountId' => function () {
         return (string) $this->membershipDiscountId;
     }, 'type', 'title', 'status', 'member' => function () {
         $member = $this->member;
         $member['id'] .= '';
         return $member;
     }, 'store', 'total', 'operationTime' => function () {
         return MongodbUtil::MongoDate2String($this->operationTime);
     }, 'createdAt' => function () {
         return MongodbUtil::MongoDate2String($this->createdAt);
     }]);
 }
Example #11
0
 /**
  * The default implementation returns the names of the columns whose values have been populated into campaignLog.
  */
 public function fields()
 {
     return array_merge(parent::fields(), ['code', 'member' => function () {
         $member = $this->member;
         if ($member) {
             $member['id'] .= '';
         }
         return $member;
     }, 'product' => function () {
         return ['id' => (string) $this->productId, 'name' => $this->productName, 'sku' => $this->sku];
     }, 'usedFrom', 'redeemTime' => function () {
         if (!empty($this->redeemTime)) {
             return MongodbUtil::MongoDate2String($this->redeemTime, 'Y-m-d H:i:s');
         } else {
             return MongodbUtil::MongoDate2String($this->createdAt, 'Y-m-d H:i:s');
         }
     }, 'createdAt' => function () {
         return MongodbUtil::MongoDate2String($this->createdAt, 'Y-m-d H:i:s');
     }]);
 }
 /**
  * The default implementation returns the names of the columns whose values have been populated into statsMemberPropAvgTradeQuaterly.
  */
 public function fields()
 {
     return array_merge(parent::fields(), ['propName', 'propValue', 'productId', 'productName', 'avg', 'year', 'quarter']);
 }
 /**
  * The default implementation returns the names of the columns whose values have been populated into statsMemberMonthly.
  */
 public function fields()
 {
     return array_merge(parent::fields(), ['month', 'origin', 'originName', 'total', 'createdAt' => function ($model) {
         return MongodbUtil::MongoDate2String($model->createdAt);
     }]);
 }
Example #14
0
 /**
  * The default implementation returns the names of the columns whose values have been populated into user.
  */
 public function fields()
 {
     return array_merge(parent::fields(), ['nick', 'avatar', 'openId', 'source', 'sourceChannel', 'accountInfo', 'lastPingTime', 'tags', 'requestTime' => function ($model) {
         return MongodbUtil::MongoDate2TimeStamp($model->requestTime);
     }]);
 }
 /**
  * Update member card after save member.
  * @see \yii\db\BaseActiveRecord::afterSave($insert, $changedAttributes)
  */
 public function afterSave($insert, $changedAttributes)
 {
     parent::afterSave($insert, $changedAttributes);
     if ($insert) {
         $this->attachBehavior('MembershipDiscountBehavior', new MembershipDiscountBehavior());
         $this->operationCoupon($this);
     }
 }
Example #16
0
 /**
  * The default implementation returns the names of the columns whose values have been populated into captcha.
  */
 public function fields()
 {
     return array_merge(parent::fields(), ['ip', 'mobile', 'code', 'isExpired']);
 }
 /**
  * The default implementation returns the names of the columns whose values have been populated into statsMemberGrowthQuarterly.
  */
 public function fields()
 {
     return array_merge(parent::fields(), ['totalNew', 'totalActive', 'totalInactive', 'year', 'quarter', 'createdAt' => function ($model) {
         return MongodbUtil::MongoDate2String($model->createdAt);
     }]);
 }
Example #18
0
 /**
  * The default implementation returns the names of the columns whose values have been populated into TradePayment.
  */
 public function fields()
 {
     return array_merge(parent::fields(), ['orderNumber', 'transactionId', 'expectedAmount', 'realAmount', 'subject', 'payMode', 'payAccount', 'status', 'user' => function () {
         $user = $this->user;
         if (!empty($user['memberId'])) {
             $user['memberId'] = (string) $user['memberId'];
         }
         return $user;
     }, 'timeExpire' => function () {
         return MongodbUtil::MongoDate2String($this->createdAt);
     }, 'createdAt' => function () {
         return MongodbUtil::MongoDate2String($this->createdAt);
     }, 'paymentTime' => function () {
         return MongodbUtil::MongoDate2String($this->paymentTime);
     }, 'couponId' => function () {
         return (string) $this->couponId;
     }]);
 }
 public function rules()
 {
     return array_merge(parent::rules(), []);
 }
 /**
  * The default implementation returns the names of the columns whose values have been populated into statsMemberPropTradeQuarterly.
  */
 public function fields()
 {
     return array_merge(parent::fields(), ['propId', 'propValue', 'total', 'year', 'quarter']);
 }
 /**
  * The default implementation returns the names of the columns whose values have been populated into statsMemberCampaignLogDaily.
  */
 public function fields()
 {
     return array_merge(parent::fields(), ['memberId', 'memProperty', 'productId', 'code', 'year', 'quarter', 'month']);
 }
Example #22
0
 public function fields()
 {
     return array_merge(parent::fields(), ['memberId', 'gameId', 'token', 'isUsed', 'validFrom', 'validTo']);
 }
 /**
  * The default implementation returns the names of the columns whose values have been populated into questionnaireLog.
  */
 public function fields()
 {
     return array_merge(parent::fields(), ['questionnaireId', 'user', 'answers']);
 }
Example #24
0
 public function fields()
 {
     return array_merge(parent::fields(), ['request', 'response', 'deviceType']);
 }
Example #25
0
 public function rules()
 {
     return array_merge(parent::rules(), [['condition', 'default', 'value' => []], ['awards', 'default', 'value' => []], ['remark', 'default', 'value' => []]]);
 }
Example #26
0
 public function rules()
 {
     return array_merge(parent::rules(), [[['name', 'phone', 'email'], 'required'], ['email', 'email'], ['avatar', 'default', 'value' => Yii::$app->params['defaultAvatar']]]);
 }
 /**
  * The default implementation returns the names of the columns whose values have been populated into PromotionCodeAnalysis.
  */
 public function fields()
 {
     return array_merge(parent::fields(), ['productId', 'campaignId', 'total', 'productName', 'type', 'createdAt' => function () {
         return MongodbUtil::MongoDate2String($this->createdAt);
     }]);
 }
 /**
  * Returns the list of all rules of admin.
  * This method must be overridden by child classes to define available attributes.
  *
  * @return array list of rules.
  */
 public function rules()
 {
     return array_merge(parent::rules(), [['usedTimes', 'default', 'value' => 0]]);
 }
Example #29
0
 /**
  * The default implementation returns the names of the columns whose values have been populated into channel.
  */
 public function fields()
 {
     return array_merge(parent::fields(), ['channelId', 'origin', 'name', 'type', 'status', 'isTest']);
 }
Example #30
0
 /**
  * The default implementation returns the names of the columns whose values have been populated into statsMemberOrder.
  */
 public function fields()
 {
     return array_merge(parent::fields(), ['consumerCount', 'consumptionAmount', 'transactionCount', 'maxConsumptionTotal', 'recentTransactionTotal']);
 }