64], [['source_sn','name','account'], 'string', 'max' => 32], [['order_id'], 'string', 'max' => 255], [['file_id'], 'string', 'max' => 200], [['download_url'], 'string', 'max' => 1000], [['form_html','msg'],"safe"] ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'mall_id' => 'ID', 'batch_sn' => '批次号', 'order_sn' => '订单号', 'type' => '1提现打款2手动转账', 'money' => '打款金额', 'status' => '1待打款2打款中3打款成功4打款失败5打款超时', 'is_delete' => '是否删除', 'created_at' => '创建时间', 'updated_at' => '更新时间', 'source_id' => '来源ID', 'source_sn' => '来源单号', 'msg' => '来源单号', 'order_id' => '支付宝转账单据号', 'file_id' => '文件申请号file_id信息', 'download_url' => '电子回单下载url', ]; } /** * 批量插入 * * @param array $insert_data * @return int */ public static function batchInsert(array $insert_data) { return \Yii::$app->db ->createCommand() ->batchInsert(static::tableName(), array_keys($insert_data[0]), $insert_data) ->execute(); } /** * 打款成功 * * @param integer $source_id * @param string $order_sn * @return void */ public static function paySuccessBySourceIdAndOrderSn( int $source_id, string $order_sn, string $order_id, string $msg = '成功' ) { static::updateAll( ['status' => 3, 'updated_at' => time(), 'msg' => $msg,'order_id'=>$order_id], ['source_id' => $source_id, 'order_sn' => $order_sn] ); // 打款成功 $cash = WithdrawLog::getLogById($source_id); WithdrawLog::remit_success($cash); } /** * 打款失败 * * @param integer $source_id * @param string $order_sn * @param string $msg * @return void */ public static function payFialBySourceIdAndOrderSn( int $source_id, string $order_sn, string $msg = '' ) { static::updateAll( ['status' => 4, 'updated_at' => time(), 'msg' => $msg], ['source_id' => $source_id, 'order_sn' => $order_sn] ); // 打款失败 $cash = WithdrawLog::getLogById($source_id); WithdrawLog::remit_fail($cash, $msg); } /** * 给这批提现订单设置一个批次号 * * @param string $batch_no * @param array $order_sns * @return int */ public static function setOutBatchNoByOrderSn(string $batch_no, array $order_sns) { return static::updateAll( ['batch_sn' => $batch_no], ['order_sn' => $order_sns] ); } }