1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <?php
- namespace app\data\service\payment;
- use app\data\model\DataUser;
- use app\data\model\DataUserBalance;
- use app\data\model\DataUserVipOrder;
- use app\data\model\ShopOrder;
- use app\data\service\PaymentService;
- use app\data\service\UserBalanceService;
- use think\admin\Exception;
- use think\admin\extend\CodeExtend;
- /**
- * 账号余额支付参数处理
- * Class BalancePaymentService
- * @package app\data\service\payment
- */
- class BalancePaymentService extends PaymentService
- {
- /**
- * 订单信息查询
- * @param string $orderNo
- * @return array
- */
- public function query(string $orderNo): array
- {
- return [];
- }
- /**
- * 支付通知处理
- * @return string
- */
- public function notify(): string
- {
- return 'SUCCESS';
- }
- /**
- * 创建订单支付参数
- * @param string $openid 用户OPENID
- * @param string $orderNo 交易订单单号
- * @param string $payAmount 交易订单金额(元)
- * @param string $payTitle 交易订单名称
- * @param string $payRemark 订单订单描述
- * @param string $payReturn 完成回跳地址
- * @param string $payImage 支付凭证图片
- * @return array
- * @throws \think\admin\Exception
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function create(string $openid, string $orderNo, string $payAmount, string $payTitle, string $payRemark, string $payReturn = '', string $payImage = '',string $notify_url = '',array $parm = []): array
- {
- $user = DataUser::mk()->where('id',$parm['uuid'])->findOrEmpty();
- //余额支付
- userMoneyChange($payAmount,1,$parm['uuid'],$payTitle,0,$parm['order_id']);
- DataUser::mk()->where('id',$parm['uuid'])->update(
- [
- 'is_vip'=>1,
- 'vip_name'=>'船白知会员',
- 'vip_order'=>$parm['order_id'],
- 'vip_datetime'=> $user->is_vip ? date('Y-m-d H:i:s',strtotime($user->vip_datetime)+(365*24*60*60)) : date('Y-m-d H:i:s',time()+(365*24*60*60))
- ]
- );
- DataUserVipOrder::mk()->where('id',$parm['order_id'])->update(
- [
- 'status'=>1,
- 'pay_at'=>date('Y-m-d H:i:s')
- ]
- );
- return ['result'=>'success'];
- }
- /**
- * 支付结果处理
- * @return string
- * @throws \WeChat\Exceptions\InvalidResponseException
- */
- public function opvip(): string
- {
- }
- /**
- * 支付结果处理
- * @return string
- * @throws \WeChat\Exceptions\InvalidResponseException
- */
- public function payorder(): string
- {
- }
- }
|