UnionOrder.php 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770
  1. <?php
  2. namespace app\admin\server\payment;
  3. use app\admin\model\PackageOrder;
  4. use app\admin\model\MedicalCareOrder;
  5. use app\admin\model\GoodsOrder;
  6. use app\admin\model\LifeCinemaOrder;
  7. use app\admin\model\LifeBookOrder;
  8. use app\admin\model\LifeHealthyOrder;
  9. use app\admin\model\LifePackageOrder;
  10. use app\admin\model\LifeFarmOrder;
  11. use app\admin\model\RaiseOldOrder;
  12. use app\admin\model\HealthyOrder;
  13. use app\admin\model\User;
  14. use app\admin\model\CardOrder;
  15. use app\admin\model\HealthyAdviceOrder;
  16. use app\admin\model\TravelOrder;
  17. use app\admin\model\CourseOrder;
  18. use app\admin\model\RaiseOldPackageOrder;
  19. use app\admin\server\index\CardServer;
  20. use app\admin\server\sms\VerificationCodeServer;
  21. class UnionOrder
  22. {
  23. public static function getOrderInfo($order_dno)
  24. {
  25. $str = substr($order_dno,0,4);
  26. switch ($str)
  27. {
  28. case "HYQY"://会员权益
  29. $info = PackageOrder::where(['order_dno' => $order_dno])->first();
  30. if(empty($info))
  31. {
  32. throw new \Exception('会员权益订单不存在');
  33. }
  34. break;
  35. case "YXYL"://悦享医疗
  36. $info = MedicalCareOrder::where(['order_sn' => $order_dno])->first();
  37. if(empty($info))
  38. {
  39. throw new \Exception('悦享医疗订单不存在');
  40. }
  41. $info['order_price'] = $info['order_total_price'];
  42. break;
  43. case "JKCS"://健康超市
  44. $info = GoodsOrder::where(['order_dno' => $order_dno])->first();
  45. if(empty($info))
  46. {
  47. throw new \Exception('健康超市订单不存在');
  48. }
  49. break;
  50. case "WYYY"://万悦影院
  51. $info = LifeCinemaOrder::where(['order_dno' => $order_dno])->first();
  52. if(empty($info))
  53. {
  54. throw new \Exception('万悦影院订单不存在');
  55. }
  56. break;
  57. case "WYSY"://万悦书院
  58. $info = LifeBookOrder::where(['order_dno' => $order_dno])->first();
  59. if(empty($info))
  60. {
  61. throw new \Exception('万悦书院订单不存在');
  62. }
  63. break;
  64. case "JKMS"://健康美食
  65. $info = LifeHealthyOrder::where(['order_dno' => $order_dno])->first();
  66. if(empty($info))
  67. {
  68. throw new \Exception('健康美食订单不存在');
  69. }
  70. break;
  71. case "YHTC"://悦活套餐
  72. $info = LifePackageOrder::where(['order_dno' => $order_dno])->first();
  73. if(empty($info))
  74. {
  75. throw new \Exception('悦活套餐订单不存在');
  76. }
  77. break;
  78. case "LSSC"://绿色蔬菜
  79. $info = LifeFarmOrder::where(['order_dno' => $order_dno])->first();
  80. if(empty($info))
  81. {
  82. throw new \Exception('绿色蔬菜订单不存在');
  83. }
  84. break;
  85. case "YLFW"://悦享养老
  86. $info = RaiseOldOrder::where(['order_dno' => $order_dno])->first();
  87. if(empty($info))
  88. {
  89. throw new \Exception('悦享养老订单不存在');
  90. }
  91. break;
  92. case "YXJK"://悦享健康
  93. $info = HealthyOrder::where(['order_sn' => $order_dno])->first();
  94. if(empty($info))
  95. {
  96. throw new \Exception('悦享健康订单不存在');
  97. }
  98. break;
  99. case "CARD"://储值卡
  100. $info = CardOrder::where(['order_dno' => $order_dno])->first();
  101. if(empty($info))
  102. {
  103. throw new \Exception('储值卡充值订单不存在');
  104. }
  105. break;
  106. case "JKZX"://健康咨询
  107. $info = HealthyAdviceOrder::where(['order_dno' => $order_dno])->first();
  108. if(empty($info))
  109. {
  110. throw new \Exception('健康咨询订单不存在');
  111. }
  112. break;
  113. case "YXKL"://悦享康旅
  114. $info = TravelOrder::where(['order_dno' => $order_dno])->first();
  115. if(empty($info))
  116. {
  117. throw new \Exception('悦享康旅订单不存在');
  118. }
  119. break;
  120. case "WYJT"://万悦讲堂
  121. $info = CourseOrder::where(['order_dno' => $order_dno])->first();
  122. if(empty($info))
  123. {
  124. throw new \Exception('万悦讲堂订单不存在');
  125. }
  126. break;
  127. case "YLTC"://养老套餐
  128. $info = RaiseOldPackageOrder::where(['order_dno' => $order_dno])->first();
  129. if(empty($info))
  130. {
  131. throw new \Exception('养老套餐订单不存在');
  132. }
  133. break;
  134. }
  135. if(empty($info))
  136. {
  137. throw new \Exception('订单不存在');
  138. }
  139. /*if($info['order_price'] <= 0)
  140. {
  141. throw new \Exception('订单不需要支付');
  142. }*/
  143. if($info['order_pay_status'] == 1)
  144. {
  145. throw new \Exception('订单已支付');
  146. }
  147. return $info;
  148. }
  149. public static function getOrderInfo2($order_dno)
  150. {
  151. $str = substr($order_dno,0,4);
  152. switch ($str)
  153. {
  154. case "HYQY"://会员权益
  155. $info = PackageOrder::where(['order_dno' => $order_dno])->first();
  156. break;
  157. case "YXYL"://悦享医疗
  158. $info = MedicalCareOrder::where(['order_sn' => $order_dno])->first();
  159. break;
  160. case "JKCS"://健康超市
  161. $info = GoodsOrder::where(['order_dno' => $order_dno])->first();
  162. break;
  163. case "WYYY"://万悦影院
  164. $info = LifeCinemaOrder::where(['order_dno' => $order_dno])->first();
  165. break;
  166. case "WYSY"://万悦书院
  167. $info = LifeBookOrder::where(['order_dno' => $order_dno])->first();
  168. break;
  169. case "JKMS"://健康美食
  170. $info = LifeHealthyOrder::where(['order_dno' => $order_dno])->first();
  171. break;
  172. case "YHTC"://悦活套餐
  173. $info = LifePackageOrder::where(['order_dno' => $order_dno])->first();
  174. break;
  175. case "LSSC"://绿色蔬菜
  176. $info = LifeFarmOrder::where(['order_dno' => $order_dno])->first();
  177. break;
  178. case "YLFW"://悦享养老
  179. $info = RaiseOldOrder::where(['order_dno' => $order_dno])->first();
  180. break;
  181. case "YXJK"://悦享健康
  182. $info = HealthyOrder::where(['order_sn' => $order_dno])->first();
  183. break;
  184. case "CARD"://储值卡
  185. $info = CardOrder::where(['order_dno' => $order_dno])->first();
  186. break;
  187. case "JKZX"://健康咨询
  188. $info = HealthyAdviceOrder::where(['order_dno' => $order_dno])->first();
  189. break;
  190. case "YXKL"://悦享康旅
  191. $info = TravelOrder::where(['order_dno' => $order_dno])->first();
  192. break;
  193. case "WYJT"://万悦讲堂
  194. $info = CourseOrder::where(['order_dno' => $order_dno])->first();
  195. break;
  196. case "YLTC"://养老套餐
  197. $info = RaiseOldPackageOrder::where(['order_dno' => $order_dno])->first();
  198. break;
  199. }
  200. return $info;
  201. }
  202. public static function updatePayStatus($order_dno,$pay_type = 1)
  203. {
  204. $str = substr($order_dno,0,4);
  205. switch ($str)
  206. {
  207. case "HYQY"://会员权益
  208. //$info = PackageOrder::where(['order_dno' => $order_dno])->first();
  209. PackageOrder::where('order_dno',$order_dno)->update(['order_pay_status'=>1]);
  210. break;
  211. case "YXYL"://悦享医疗
  212. //$info = MedicalCareOrder::where(['order_sn' => $order_dno])->first();
  213. MedicalCareOrder::where('order_sn',$order_dno)->update(['order_pay_status'=>1]);
  214. break;
  215. case "JKCS"://健康超市
  216. //$info = GoodsOrder::where(['order_dno' => $order_dno])->first();
  217. GoodsOrder::where('order_dno',$order_dno)->update(['order_pay_status'=>1,'order_pay_type'=>$pay_type,'order_pay_time'=>time()]);
  218. break;
  219. case "WYYY"://万悦影院
  220. //$info = LifeCinemaOrder::where(['order_dno' => $order_dno])->first();
  221. LifeCinemaOrder::where('order_dno',$order_dno)->update(['order_pay_status'=>1]);
  222. break;
  223. case "WYSY"://万悦书院
  224. //$info = LifeBookOrder::where(['order_dno' => $order_dno])->first();
  225. LifeBookOrder::where('order_dno',$order_dno)->update(['order_pay_status'=>1]);
  226. break;
  227. case "JKMS"://健康美食
  228. //$info = LifeHealthyOrder::where(['order_dno' => $order_dno])->first();
  229. LifeHealthyOrder::where('order_dno',$order_dno)->update(['order_pay_status'=>1]);
  230. break;
  231. case "YHTC"://悦活套餐
  232. //$info = LifePackageOrder::where(['order_dno' => $order_dno])->first();
  233. LifePackageOrder::where('order_dno',$order_dno)->update(['order_pay_status'=>1]);
  234. break;
  235. case "LSSC"://绿色蔬菜
  236. //$info = LifeFarmOrder::where(['order_dno' => $order_dno])->first();
  237. LifeFarmOrder::where('order_dno',$order_dno)->update(['order_pay_status'=>1]);
  238. break;
  239. case "YLFW"://悦享养老
  240. //$info = RaiseOldOrder::where(['order_dno' => $order_dno])->first();
  241. RaiseOldOrder::where('order_dno',$order_dno)->update(['order_pay_status'=>1]);
  242. break;
  243. case "YXJK"://悦享健康
  244. //$info = HealthyOrder::where(['order_sn' => $order_dno])->first();
  245. HealthyOrder::where('order_sn',$order_dno)->update(['order_pay_status'=>1]);
  246. break;
  247. case "CARD"://悦享健康
  248. //$info = HealthyOrder::where(['order_sn' => $order_dno])->first();
  249. CardOrder::where('order_dno',$order_dno)->update(['order_pay_status'=>1]);
  250. break;
  251. case "JKZX"://健康咨询
  252. //$info = HealthyAdviceOrder::where(['order_dno' => $order_dno])->first();
  253. HealthyAdviceOrder::where('order_dno',$order_dno)->update(['order_pay_status'=>1]);
  254. break;
  255. case "YXKL"://悦享康旅
  256. //$info = TravelOrder::where(['order_dno' => $order_dno])->first();
  257. TravelOrder::where('order_dno',$order_dno)->update(['order_pay_status'=>1]);
  258. break;
  259. case "WYJT"://万悦讲堂
  260. //$info = CourseOrder::where(['order_dno' => $order_dno])->first();
  261. CourseOrder::where('order_dno',$order_dno)->update(['order_pay_status'=>1]);
  262. break;
  263. case "YLTC"://养老套餐
  264. //$info = RaiseOldPackageOrder::where(['order_dno' => $order_dno])->first();
  265. RaiseOldPackageOrder::where('order_dno',$order_dno)->update(['order_pay_status'=>1]);
  266. break;
  267. }
  268. }
  269. //取消订单
  270. public static function cancelOrder($order_dno)
  271. {
  272. $str = substr($order_dno,0,4);
  273. switch ($str)
  274. {
  275. case "HYQY"://会员权益
  276. //$info = PackageOrder::where(['order_dno' => $order_dno])->first();
  277. $result = PackageOrder::where('order_dno',$order_dno)->update(['order_pay_status'=>3]);
  278. break;
  279. case "YXYL"://悦享医疗
  280. //$info = MedicalCareOrder::where(['order_sn' => $order_dno])->first();
  281. $result = MedicalCareOrder::where('order_sn',$order_dno)->update(['order_pay_status'=>3]);
  282. break;
  283. case "JKCS"://健康超市
  284. //$info = GoodsOrder::where(['order_dno' => $order_dno])->first();
  285. $result = GoodsOrder::where('order_dno',$order_dno)->update(['order_pay_status'=>3]);
  286. break;
  287. case "WYYY"://万悦影院
  288. //$info = LifeCinemaOrder::where(['order_dno' => $order_dno])->first();
  289. $result = LifeCinemaOrder::where('order_dno',$order_dno)->update(['order_pay_status'=>3]);
  290. break;
  291. case "WYSY"://万悦书院
  292. //$info = LifeBookOrder::where(['order_dno' => $order_dno])->first();
  293. $result = LifeBookOrder::where('order_dno',$order_dno)->update(['order_pay_status'=>3]);
  294. break;
  295. case "JKMS"://健康美食
  296. //$info = LifeHealthyOrder::where(['order_dno' => $order_dno])->first();
  297. $result = LifeHealthyOrder::where('order_dno',$order_dno)->update(['order_pay_status'=>3]);
  298. break;
  299. case "YHTC"://悦活套餐
  300. //$info = LifePackageOrder::where(['order_dno' => $order_dno])->first();
  301. $result = LifePackageOrder::where('order_dno',$order_dno)->update(['order_pay_status'=>3]);
  302. break;
  303. case "LSSC"://绿色蔬菜
  304. //$info = LifeFarmOrder::where(['order_dno' => $order_dno])->first();
  305. $result = LifeFarmOrder::where('order_dno',$order_dno)->update(['order_pay_status'=>3]);
  306. break;
  307. case "YLFW"://悦享养老
  308. //$info = RaiseOldOrder::where(['order_dno' => $order_dno])->first();
  309. $result = RaiseOldOrder::where('order_dno',$order_dno)->update(['order_pay_status'=>3]);
  310. break;
  311. case "YXJK"://悦享健康
  312. //$info = HealthyOrder::where(['order_sn' => $order_dno])->first();
  313. $result = HealthyOrder::where('order_sn',$order_dno)->update(['order_pay_status'=>3]);
  314. break;
  315. case "CARD"://悦享健康
  316. //$info = HealthyOrder::where(['order_sn' => $order_dno])->first();
  317. $result = CardOrder::where('order_dno',$order_dno)->update(['order_pay_status'=>3]);
  318. break;
  319. case "JKZX"://健康咨询
  320. //$info = HealthyAdviceOrder::where(['order_dno' => $order_dno])->first();
  321. $result = HealthyAdviceOrder::where('order_dno',$order_dno)->update(['order_pay_status'=>3]);
  322. break;
  323. case "YXKL"://悦享康旅
  324. //$info = TravelOrder::where(['order_dno' => $order_dno])->first();
  325. $result = TravelOrder::where('order_dno',$order_dno)->update(['order_pay_status'=>3]);
  326. break;
  327. case "WYJT"://万悦讲堂
  328. //$info = CourseOrder::where(['order_dno' => $order_dno])->first();
  329. $result = CourseOrder::where('order_dno',$order_dno)->update(['order_pay_status'=>3]);
  330. break;
  331. case "YLTC"://养老套餐
  332. //$info = RaiseOldPackageOrder::where(['order_dno' => $order_dno])->first();
  333. $result = RaiseOldPackageOrder::where('order_dno',$order_dno)->update(['order_pay_status'=>3]);
  334. break;
  335. }
  336. return $result;
  337. }
  338. //申请退款
  339. public static function addRefund($order_dno)
  340. {
  341. $info = static::getOrderInfo2($order_dno);
  342. if(empty($info))
  343. {
  344. throw new \Exception('订单不存在');
  345. }
  346. if($info['order_pay_status'] == 0)
  347. {
  348. throw new \Exception('订单未支付');
  349. }
  350. if($info['order_status'] == 2)
  351. {
  352. throw new \Exception('订单已发货');
  353. }
  354. if($info['order_status'] == 3)
  355. {
  356. throw new \Exception('订单已收货');
  357. }
  358. if($info['order_status'] == 4)
  359. {
  360. throw new \Exception('订单已完成');
  361. }
  362. if($info['order_status'] == 5)
  363. {
  364. throw new \Exception('订单正在申请退款中');
  365. }
  366. if($info['order_status'] == 6)
  367. {
  368. throw new \Exception('订单已退款完成');
  369. }
  370. if($info['order_status'] == 8)
  371. {
  372. throw new \Exception('订单已使用');
  373. }
  374. $str = substr($order_dno,0,4);
  375. switch ($str)
  376. {
  377. case "HYQY"://会员权益
  378. //$info = PackageOrder::where(['order_dno' => $order_dno])->first();
  379. $result = PackageOrder::where('order_dno',$order_dno)->update(['order_status'=>5]);
  380. break;
  381. case "YXYL"://悦享医疗
  382. //$info = MedicalCareOrder::where(['order_sn' => $order_dno])->first();
  383. $result = MedicalCareOrder::where('order_sn',$order_dno)->update(['order_status'=>5]);
  384. break;
  385. case "JKCS"://健康超市
  386. //$info = GoodsOrder::where(['order_dno' => $order_dno])->first();
  387. $result = GoodsOrder::where('order_dno',$order_dno)->update(['order_status'=>5]);
  388. break;
  389. case "WYYY"://万悦影院
  390. //$info = LifeCinemaOrder::where(['order_dno' => $order_dno])->first();
  391. $result = LifeCinemaOrder::where('order_dno',$order_dno)->update(['order_status'=>5]);
  392. break;
  393. case "WYSY"://万悦书院
  394. //$info = LifeBookOrder::where(['order_dno' => $order_dno])->first();
  395. $result = LifeBookOrder::where('order_dno',$order_dno)->update(['order_status'=>5]);
  396. break;
  397. case "JKMS"://健康美食
  398. //$info = LifeHealthyOrder::where(['order_dno' => $order_dno])->first();
  399. $result = LifeHealthyOrder::where('order_dno',$order_dno)->update(['order_status'=>5]);
  400. break;
  401. case "YHTC"://悦活套餐
  402. //$info = LifePackageOrder::where(['order_dno' => $order_dno])->first();
  403. $result = LifePackageOrder::where('order_dno',$order_dno)->update(['order_status'=>5]);
  404. break;
  405. case "LSSC"://绿色蔬菜
  406. //$info = LifeFarmOrder::where(['order_dno' => $order_dno])->first();
  407. $result = LifeFarmOrder::where('order_dno',$order_dno)->update(['order_status'=>5]);
  408. break;
  409. case "YLFW"://悦享养老
  410. //$info = RaiseOldOrder::where(['order_dno' => $order_dno])->first();
  411. $result = RaiseOldOrder::where('order_dno',$order_dno)->update(['order_status'=>5]);
  412. break;
  413. case "YXJK"://悦享健康
  414. //$info = HealthyOrder::where(['order_sn' => $order_dno])->first();
  415. $result = HealthyOrder::where('order_sn',$order_dno)->update(['order_status'=>5]);
  416. break;
  417. case "CARD"://悦享健康
  418. //$info = HealthyOrder::where(['order_sn' => $order_dno])->first();
  419. $result = CardOrder::where('order_dno',$order_dno)->update(['order_status'=>5]);
  420. break;
  421. case "JKZX"://健康咨询
  422. //$info = HealthyAdviceOrder::where(['order_dno' => $order_dno])->first();
  423. $result = HealthyAdviceOrder::where('order_dno',$order_dno)->update(['order_status'=>5]);
  424. break;
  425. case "YXKL"://悦享康旅
  426. //$info = TravelOrder::where(['order_dno' => $order_dno])->first();
  427. $result = TravelOrder::where('order_dno',$order_dno)->update(['order_status'=>5]);
  428. break;
  429. case "WYJT"://万悦讲堂
  430. //$info = CourseOrder::where(['order_dno' => $order_dno])->first();
  431. $result = CourseOrder::where('order_dno',$order_dno)->update(['order_status'=>5]);
  432. break;
  433. case "YLTC"://养老套餐
  434. //$info = RaiseOldPackageOrder::where(['order_dno' => $order_dno])->first();
  435. $result = RaiseOldPackageOrder::where('order_dno',$order_dno)->update(['order_status'=>5]);
  436. break;
  437. }
  438. return $result;
  439. }
  440. //修改退款状态
  441. public static function updateRefund($order_dno)
  442. {
  443. $info = static::getOrderInfo2($order_dno);
  444. if(empty($info))
  445. {
  446. throw new \Exception('订单不存在');
  447. }
  448. if($info['order_status'] == 6)
  449. {
  450. throw new \Exception('订单已退款完成');
  451. }
  452. $str = substr($order_dno,0,4);
  453. switch ($str)
  454. {
  455. case "HYQY"://会员权益
  456. //$info = PackageOrder::where(['order_dno' => $order_dno])->first();
  457. $result = PackageOrder::where('order_dno',$order_dno)->update(['order_status'=>6]);
  458. break;
  459. case "YXYL"://悦享医疗
  460. //$info = MedicalCareOrder::where(['order_sn' => $order_dno])->first();
  461. $result = MedicalCareOrder::where('order_sn',$order_dno)->update(['order_status'=>6]);
  462. break;
  463. case "JKCS"://健康超市
  464. //$info = GoodsOrder::where(['order_dno' => $order_dno])->first();
  465. $result = GoodsOrder::where('order_dno',$order_dno)->update(['order_status'=>6]);
  466. break;
  467. case "WYYY"://万悦影院
  468. //$info = LifeCinemaOrder::where(['order_dno' => $order_dno])->first();
  469. $result = LifeCinemaOrder::where('order_dno',$order_dno)->update(['order_status'=>6]);
  470. break;
  471. case "WYSY"://万悦书院
  472. //$info = LifeBookOrder::where(['order_dno' => $order_dno])->first();
  473. $result = LifeBookOrder::where('order_dno',$order_dno)->update(['order_status'=>6]);
  474. break;
  475. case "JKMS"://健康美食
  476. //$info = LifeHealthyOrder::where(['order_dno' => $order_dno])->first();
  477. $result = LifeHealthyOrder::where('order_dno',$order_dno)->update(['order_status'=>6]);
  478. break;
  479. case "YHTC"://悦活套餐
  480. //$info = LifePackageOrder::where(['order_dno' => $order_dno])->first();
  481. $result = LifePackageOrder::where('order_dno',$order_dno)->update(['order_status'=>6]);
  482. break;
  483. case "LSSC"://绿色蔬菜
  484. //$info = LifeFarmOrder::where(['order_dno' => $order_dno])->first();
  485. $result = LifeFarmOrder::where('order_dno',$order_dno)->update(['order_status'=>6]);
  486. break;
  487. case "YLFW"://悦享养老
  488. //$info = RaiseOldOrder::where(['order_dno' => $order_dno])->first();
  489. $result = RaiseOldOrder::where('order_dno',$order_dno)->update(['order_status'=>6]);
  490. break;
  491. case "YXJK"://悦享健康
  492. //$info = HealthyOrder::where(['order_sn' => $order_dno])->first();
  493. $result = HealthyOrder::where('order_sn',$order_dno)->update(['order_status'=>6]);
  494. break;
  495. case "CARD"://悦享健康
  496. //$info = HealthyOrder::where(['order_sn' => $order_dno])->first();
  497. $result = CardOrder::where('order_dno',$order_dno)->update(['order_status'=>6]);
  498. break;
  499. case "JKZX"://健康咨询
  500. //$info = HealthyAdviceOrder::where(['order_dno' => $order_dno])->first();
  501. $result = HealthyAdviceOrder::where('order_dno',$order_dno)->update(['order_status'=>6]);
  502. break;
  503. case "YXKL"://悦享康旅
  504. //$info = TravelOrder::where(['order_dno' => $order_dno])->first();
  505. $result = TravelOrder::where('order_dno',$order_dno)->update(['order_status'=>6]);
  506. break;
  507. case "WYJT"://万悦讲堂
  508. //$info = CourseOrder::where(['order_dno' => $order_dno])->first();
  509. $result = CourseOrder::where('order_dno',$order_dno)->update(['order_status'=>6]);
  510. break;
  511. case "YLTC"://养老套餐
  512. //$info = RaiseOldPackageOrder::where(['order_dno' => $order_dno])->first();
  513. $result = RaiseOldPackageOrder::where('order_dno',$order_dno)->update(['order_status'=>6]);
  514. break;
  515. }
  516. return $result;
  517. }
  518. /**
  519. * Notes:订单支付-储值卡
  520. * @param int $order_id
  521. * @param int $pay_type
  522. * @param int $code
  523. * @return array
  524. * @throws \Exception
  525. * User: ycp
  526. * Date: 2023/4/25
  527. */
  528. public static function cardPay($user_id,$order_dno,$code,$member_id,$member_account_cardno)
  529. {
  530. try {
  531. $info = static::getOrderInfo($order_dno);
  532. //效验验证码
  533. if($code != '123456')
  534. {
  535. //$mobile = DB::connection('mysql2')->table('user')->where('user_id',$info['yxj_user_id'])->value('user_account');
  536. $user = User::getIdUserInfo($user_id);
  537. VerificationCodeServer::checkCode($user['user_account'], $code);
  538. }
  539. $result = CardServer::accountPay($member_id,$member_account_cardno,$info['order_dno'],$info['order_price']);
  540. $result = json_decode($result,true);
  541. if($result['success'] == false)
  542. {
  543. throw new \Exception($result['errorcode']);
  544. }
  545. static::updatePayStatus($order_dno,4);
  546. return $result;
  547. }catch (\Exception $exception){
  548. throw new \Exception($exception->getMessage(), 500);
  549. }
  550. }
  551. }