$sqlProcedure = " CALL `p_Recharge`(:in_user_id, :in_recharge_id, :in_operate_type, :in_trade_no, :in_error_remark, @p5, @p6) ";
$cmd = Yii::$app->db->createCommand($sqlProcedure);
$cmd->bindParam(':in_user_id',$userId);
$cmd->bindParam(':in_recharge_id',$userRechargeId);
$cmd->bindValue(':in_operate_type',1); //1-成功,2-失败
$cmd->bindParam(':in_trade_no',$tradeNo);
$cmd->bindValue(':in_error_remark','');
$res = $cmd->execute();
$s = Yii::$app->db->createCommand(" SELECT @p5 AS `out_status`, @p6 AS `out_remark`");
$ret = $s->queryOne();
Yii::error($ret,'procedure');
$userRecharge = UserRecharge::findOne(['id' => $userRechargeId]);
if($ret['out_status'] == 1){
$resultArray['ResultCode'] = 1;
$resultArray['ResultMsg'] = '成功!';
}else {
$resultArray['ResultCode'] = -1;
$resultArray['ResultMsg'] = '失败!';
}
Yii2调用存程例子
最新推荐文章于 2018-02-01 11:41:00 发布