Exemplo n.º 1
0
 public function extraFields()
 {
     $fields = parent::fields();
     $fields['hotsale'] = 'hotsale';
     $fields['medicine'] = 'medicine';
     $fields['user'] = '******';
     return $fields;
 }
Exemplo n.º 2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Order::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'user_id' => $this->user_id, 'medicine_id' => $this->medicine_id, 'hotsale_id' => $this->hotsale_id, 'amount' => $this->amount, 'create_time' => $this->create_time, 'street_number' => $this->street_number, 'status' => $this->status, 'update_time' => $this->update_time, 'delect' => $this->delect, 'total' => $this->total]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'street', $this->street])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'zipcord', $this->zipcord]);
     return $dataProvider;
 }
Exemplo n.º 3
0
 public static function synchronizeStatuses()
 {
     $tasks = Vk::getTasks();
     $tasks = ArrayHelper::merge($tasks, Instagram::getTasks());
     $tasks = ArrayHelper::merge($tasks, Twitter::getTasks());
     $tasks = ArrayHelper::merge($tasks, AskFM::getTasks());
     foreach ($tasks as $task) {
         if ($task->finished) {
             $order = Order::findOne(['foreign_id' => $task->id]);
             if (isset($order->status)) {
                 if ($order->status == Order::PROCESSED) {
                     $order->status = Order::DONE;
                     $order->save();
                 }
             }
         }
     }
 }
Exemplo n.º 4
0
 public function rules()
 {
     return array_merge(parent::rules(), []);
 }
Exemplo n.º 5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getOrders()
 {
     return $this->hasMany(Order::className(), ['user_id' => 'id']);
 }
Exemplo n.º 6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getOrder()
 {
     return $this->hasOne(Order::className(), ['id' => 'order_id']);
 }