'', 'total_amount'=>'', 'subject'=>'', 'body'=>'', 'valid_time'=>86400, 'notify_url'=>'', 'thirdparty_id'=>'' ]; public function __construct() { } /** * @param mixed $order_no * @param $amount * @param $subject * @return ByteDancePay */ public static function setInfo($order_no,$amount,$subject) { $class=new self; $class->data['app_id']=ByteDance::appId(); $class->data['out_order_no'] = $order_no; $class->data['total_amount'] = $amount*100; $class->data['subject'] = $subject; $class->data['body'] = $subject; $class->data['notify_url']=request()->domain().'/index/payment/notify_dy/order_no/'.$order_no; return $class; } /** * @param mixed $order_no * @param $amount * @param $subject * @return ByteDancePay */ public static function setInfo2($order_no,$amount,$subject) { $class=new self; $class->data['app_id']=ByteDance::appIdTwo(); $class->data['out_order_no'] = $order_no; $class->data['total_amount'] = $amount*100; $class->data['subject'] = $subject; $class->data['body'] = $subject; $class->data['notify_url']=request()->domain().'/index/payment/notify_dy/order_no/'.$order_no; return $class; } public function get() { $data=$this->data; $data['sign']=ByteDance::sign($data); $order=ByteDance::httpPost('https://developer.toutiao.com/api/apps/ecpay/v1/create_order',$data); $obj=ByteDanceResult::make(); foreach ($order as $key=>$item){ $obj->offsetSet($key,$item); } return $obj; } } /** * @property string $order_id * @property string $order_token * @property string $url */ class ByteDanceResult extends Collection {}