/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = SinaNotifyWithdraw::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, 'withdraw_amount' => $this->withdraw_amount]);
     $query->andFilterWhere(['like', 'outer_trade_no', $this->outer_trade_no])->andFilterWhere(['like', 'inner_trade_no', $this->inner_trade_no])->andFilterWhere(['like', 'withdraw_status', $this->withdraw_status])->andFilterWhere(['like', 'card_id', $this->card_id]);
     return $dataProvider;
 }
Пример #2
0
 /**
  * 接收提现回调
  */
 public function notify_withdraw($data)
 {
     $out_trade_no = $data['outer_trade_no'];
     if (!empty($out_trade_no)) {
         $trade = new SinaNotifyWithdraw();
         $trade->outer_trade_no = $out_trade_no;
         $trade->inner_trade_no = $data['inner_trade_no'];
         $trade->withdraw_amount = $data['withdraw_amount'];
         $trade->withdraw_status = $data['withdraw_status'];
         $trade->card_id = array_key_exists('card_id', $data) ? $data['card_id'] : '';
         $trade->save();
     }
 }