|
@@ -36,4 +36,29 @@ class Trylesson extends Api
|
|
|
|
|
|
$this->success(1,$info);
|
|
|
}
|
|
|
+
|
|
|
+ public function apply(){
|
|
|
+ $id = input('id',0);
|
|
|
+ $info = Db::name('trylesson')->where('id',$id)->where('is_show',1)->find();
|
|
|
+ if(empty($info)){
|
|
|
+ $this->error('该试课已下架');
|
|
|
+ }
|
|
|
+
|
|
|
+ $field = ['firstname','lastname','mobile','email','height','age','weight','address','health','emergency','comefrom','is_first'];
|
|
|
+ $data = request_post_hub($field);
|
|
|
+
|
|
|
+ $sysdata = [
|
|
|
+ 'order_no' => createUniqueNo('T',$this->auth->id),
|
|
|
+ 'user_id' => $this->auth->id,
|
|
|
+ 'trylesson_id' => $id,
|
|
|
+ 'order_amount' => $info['price'],
|
|
|
+ 'order_status' => 0,
|
|
|
+ 'createtime' => time(),
|
|
|
+ ];
|
|
|
+
|
|
|
+ $data = array_merge($data,$sysdata);
|
|
|
+
|
|
|
+ $id = Db::name('trylesson_order')->insertGetId($data);
|
|
|
+ $this->success('提交成功',$id);
|
|
|
+ }
|
|
|
}
|