AllwinEcardOrder.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2017 https://www.sapixx.com All rights reserved.
  4. * @license Licensed (http://www.apache.org/licenses/LICENSE-2.0).
  5. * @author pillar<ltmn@qq.com>
  6. * 订单数据
  7. */
  8. namespace app\allwin\model;
  9. use think\Model;
  10. class AllwinEcardOrder extends Model{
  11. protected $pk = 'id';
  12. /**
  13. * @return \think\model\relation\HasOne
  14. * 用户
  15. */
  16. public function user(){
  17. return $this->hasOne('app\common\model\SystemUser','id','uid');
  18. }
  19. /**
  20. * @param $data
  21. * @param $order_no
  22. * 购买商品生成订单数据
  23. */
  24. public static function insertOrder($data,$order_no){
  25. $order = [
  26. 'member_miniapp_id' => $data['member_miniapp_id'],
  27. 'card_id' => $data['card_id'],
  28. 'uid' => $data['uid'],
  29. 'order_no' => $order_no,
  30. 'status' => 0,
  31. 'paid_at' => 0,
  32. 'shop_id' => $data['id'],
  33. 'amount' => $data['amount'],
  34. 'create_time' => time()
  35. ];
  36. self::create($order);
  37. }
  38. }