/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Payment::find()->orderBy('id DESC'); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 10]]); $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, 'uid' => $this->uid, 'transtime' => $this->transtime, 'amount' => $this->amount, 'orderexpdate' => $this->orderexpdate, 'status' => $this->status, 'sendtime' => $this->sendtime, 'ybamount' => $this->ybamount, 'create_at' => $this->create_at, 'update_at' => $this->update_at]); $query->andFilterWhere(['like', 'orderid', $this->orderid])->andFilterWhere(['like', 'userip', $this->userip])->andFilterWhere(['like', 'productname', $this->productname])->andFilterWhere(['like', 'identityid', $this->identityid])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'yborderid', $this->yborderid])->andFilterWhere(['like', 'msg', $this->msg]); return $dataProvider; }
/** * 记录用户的充值记录 * @param $uid * @param $orderid * @param $transtime * @param $amount * @param $productname * @param $identityid * @param $orderexpdate * @param $phone * @param $userip * @param $status * @param $msg * @param string $sendtime * @param string $yborderid * @param string $ybamount * @return bool */ private static function paymentLog($uid, $orderid, $transtime, $amount, $productname, $identityid, $orderexpdate, $phone, $userip, $status, $msg, $sendtime = '', $yborderid = '', $ybamount = '') { $pay = new Payment(); $pay->uid = (int) $uid; $pay->orderid = $orderid; $pay->transtime = $transtime; $pay->amount = (int) $amount; $pay->productname = $productname; $pay->identityid = $identityid; $pay->orderexpdate = (int) $orderexpdate; $pay->phone = $phone; $pay->userip = $userip; $pay->status = $status; $pay->msg = $msg; $pay->sendtime = $sendtime; $pay->yborderid = $yborderid; $pay->ybamount = $ybamount; $flag = $pay->save(); return $flag; }
/** * Finds the Payment model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Payment the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Payment::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }