作者 何书鹏
1 个管道 的构建 通过 耗费 0 秒

api更新

... ... @@ -170,7 +170,7 @@ class Index extends Api
// ->find();
// empty($doctor) && $this->error('已被预约满了,请再等等或选择其他日期预约');
$dept_ids = $post['dept_id'];
$pay_price = $post['type'] == 1 ? $dept['text_price'] : $dept['audio_price'];
$pay_fee = $post['type'] == 1 ? $dept['text_price'] : $dept['audio_price'];
$doctor_id = 0;
$is_distribute = '0';
}else{
... ... @@ -178,7 +178,7 @@ class Index extends Api
empty($doctor) && $this->error('医生信息不存在');
$dept_ids = Dept::where('id','in',$doctor['dept_ids'])->where('pid',0)->column('id');
$dept_ids = implode(',',$dept_ids);
$pay_price = $post['type'] == 1 ? $doctor['text_price'] : $doctor['audio_price'];
$pay_fee = $post['type'] == 1 ? $doctor['text_price'] : $doctor['audio_price'];
$doctor_id = $post['doctor_id'];
$is_distribute = '1';
}
... ... @@ -187,7 +187,7 @@ class Index extends Api
'user_id' => $this->auth->id,
'order_sn' => get_order_sn(),
'doctor_id' => $doctor_id,
'pay_price' => $pay_price,
'pay_fee' => $pay_fee,
'dept_ids' => $dept_ids,
'type' => $post['type'],
'date' => $post['date'],
... ... @@ -197,7 +197,7 @@ class Index extends Api
// // 发起微信支付
// $Wechat = new Wechat;
// $openid = Db::name('third')->where('user_id',$this->auth->id)->value('openid');
// if(!$payment = $Wechat->wxPay($appointment['order_sn'], $openid, $pay_price)){
// if(!$payment = $Wechat->wxPay($appointment['order_sn'], $openid, $pay_fee)){
// $this->error($Wechat->getError());
// }
(new Notify())->notifyAppointmentZero([
... ...
... ... @@ -100,7 +100,7 @@ class Notify extends Api
$money = Doctor::where('id',$appointment['doctor_id'])->sum('money');
DoctorMoneyLog::create([
'doctor_id' => $appointment['doctor_id'],
'money' => $appointment['pay_price'],
'money' => $appointment['pay_fee'],
'before' => $money,
'after' => $money,
'memo' => '即将到账',
... ... @@ -180,6 +180,9 @@ class Notify extends Api
$order->pay_time = time(); // 更新支付时间为当前时间
$order->pay_status = '1';
$order->save();
// 打赏金额
$appointment = $order['appointment'];
$appointment->setInc('gift_fee',$order['pay_fee']);
return true;
}
}
... ...
... ... @@ -483,7 +483,7 @@ class User extends Api
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @ApiParams (name="is_custom", type="string", required=true, description="是否自定义:0=否,1=是")
* @ApiParams (name="gift_id", type="inter", required=false, description="礼物ID")
* @ApiParams (name="pay_price", type="float", required=false, description="自定义金额")
* @ApiParams (name="money", type="float", required=false, description="自定义金额")
* @ApiReturn({
"code": 1, //返回码:0=错误普通提示,1=成功,2=普通弹窗提示,3=跳转弹窗提示
"msg": "成功",
... ... @@ -497,17 +497,18 @@ class User extends Api
public function payGift(){
$is_custom = $this->request->post('is_custom');
$gift_id = $this->request->post('gift_id');
$pay_price = $this->request->post('pay_price');
$money = $this->request->post('money');
!isset($is_custom) && $this->error('缺少必需参数');
switch ($is_custom){
case '0':
empty($gift_id) && $this->error('请选择礼物');
$gift = Gift::get($gift_id);
empty($gift) && $this->error('礼物不存在');
$pay_price = $gift['price'];
$pay_fee = $gift['price'];
break;
case '1':
empty($pay_price) && $this->error('请填写自定义金额');
empty($money) && $this->error('请填写自定义金额');
$pay_fee = $money;
break;
default:
$this->error('参数不合法');
... ... @@ -516,10 +517,10 @@ class User extends Api
'user_id' => $this->auth->id,
'order_sn' => get_order_sn(),
'gift_id' => $is_custom == '0' ? $gift_id : 0,
'pay_price' => $pay_price,
'pay_fee' => $pay_fee,
]);
$payment = [];
if($pay_price <= 0){
if($pay_fee <= 0){
(new Notify())->notifyGiftZero([
'out_trade_no' => $order['order_sn'],
'transaction_id' => ''
... ... @@ -528,7 +529,7 @@ class User extends Api
// // 发起微信支付
// $Wechat = new Wechat;
// $openid = Db::name('third')->where('user_id',$this->auth->id)->value('openid');
// if(!$payment = $Wechat->wxPay($this->model['order_sn'], $openid, $pay_price)){
// if(!$payment = $Wechat->wxPay($this->model['order_sn'], $openid, $pay_fee)){
// $this->error($Wechat->getError());
// }
(new Notify())->notifyGiftZero([
... ...
... ... @@ -16,4 +16,9 @@ class GiftOrder extends Model
protected $updateTime = 'updatetime';
// 追加属性
protected $append = [];
// 预约
public function appointment(){
return $this->belongsTo('Appointment');
}
}
... ...
... ... @@ -6379,7 +6379,7 @@
<td>礼物ID</td>
</tr>
<tr>
<td>pay_price</td>
<td>money</td>
<td>float</td>
<td></td>
<td>自定义金额</td>
... ... @@ -6426,8 +6426,8 @@
<input type="inter" class="form-control input-sm" id="gift_id" placeholder="礼物ID" name="gift_id">
</div>
<div class="form-group">
<label class="control-label" for="pay_price">pay_price</label>
<input type="float" class="form-control input-sm" id="pay_price" placeholder="自定义金额" name="pay_price">
<label class="control-label" for="money">money</label>
<input type="float" class="form-control input-sm" id="money" placeholder="自定义金额" name="money">
</div>
<div class="form-group form-group-submit">
<button type="submit" class="btn btn-success send" rel="37">提交</button>
... ... @@ -7412,7 +7412,7 @@
</div>
<div class="col-md-6" align="right">
Generated on 2021-07-07 10:21:05 <a href="./" target="_blank">我的网站</a>
Generated on 2021-07-07 13:50:20 <a href="./" target="_blank">我的网站</a>
</div>
</div>
... ...