138 lines
4.9 KiB
PHP
138 lines
4.9 KiB
PHP
<?php
|
|
/**
|
|
* SAAS应用系统 --- 十年开发经验汇集巨献!
|
|
* ==========================================================
|
|
* Copy right 2020-2050 成都众联思索科技有限公司,保留所有权利。
|
|
* ----------------------------------------------------------
|
|
* 官方网址: https://www.zoomtk.com
|
|
* 这不是自由软件!未经允许不得用于商业目或程序代码摘取及修改。
|
|
* 任何企业和个人未经允许对程序代码以任何形式任何目的再发布传播。
|
|
* 唯一发布渠道www.zoomtk.com;非官方渠道统一视为侵权行为。
|
|
* ==========================================================
|
|
*/
|
|
|
|
namespace addon\saas\model;
|
|
|
|
use app\model\DbModel;
|
|
|
|
class PayShop extends DbModel
|
|
{
|
|
protected $autoWriteTimestamp = 'int';
|
|
protected $json = ['wechatpay_value', 'alipay_value', 'zmalipay_value'];
|
|
protected $jsonAssoc = true;
|
|
protected $pk = 'shop_id';
|
|
|
|
public function getStore()
|
|
{
|
|
}
|
|
|
|
/***
|
|
* 获取分页
|
|
* @param $condition
|
|
* @param int $page
|
|
* @param int $page_size
|
|
* @param string $field
|
|
* @param string $order
|
|
* @return array
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
*/
|
|
public function getPageList($condition, $page = 1, $page_size = PAGE_LIST_ROWS, $field = '*', $order = 'create_time desc', $join = [], $group = null, $alias = '')
|
|
{
|
|
$res = model('pay_shop')->pageList($condition, $field, $order, $page, $page_size, $alias, $join, $group);
|
|
return success(0, '', $res);
|
|
}
|
|
|
|
/***
|
|
* 保存支付
|
|
* @param $data
|
|
* @param $payInfo
|
|
* @param $site_id
|
|
* @param $rate 费率
|
|
* @return array
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
*/
|
|
public function PaySave($data, $payInfo, $site_id, $member_id = 0, $rate = '0.6')
|
|
{
|
|
$merchant_name = '';
|
|
if (isset($data['subject_info']['business_license_info']['merchant_name'])) {
|
|
$merchant_name = $data['subject_info']['business_license_info']['merchant_name'];
|
|
} else if ($data['subject_info']['certificate_info']['merchant_name']) {
|
|
$merchant_name = $data['subject_info']['certificate_info']['merchant_name'];
|
|
}
|
|
$date = [
|
|
'merchant_name' => $merchant_name,
|
|
'contacts_name' => $data['contact_info']['contact_name'],
|
|
'contacts_phone' => $data['contact_info']['mobile_phone'],
|
|
'site_id' => $site_id,
|
|
'ag_member_id' => $member_id,
|
|
'pay_type' => 'wechatpay',
|
|
'states' => 0,
|
|
'rate' => $rate,
|
|
'subject_type' => $data['subject_type'],
|
|
'wechatpay_value' => $payInfo,
|
|
'business_code' => $data['business_code'],
|
|
'isDrafts' => $data['isDrafts'],
|
|
'reg_money' => $data['reg_money'],
|
|
];
|
|
if ($data['shop_id'] > 0) {
|
|
$find = $this->where('shop_id', $data['shop_id'])->find();
|
|
} else {
|
|
$find = $this->where('business_code', $data['business_code'])->find();
|
|
}
|
|
if ($find) {
|
|
$find->save($date);
|
|
} else {
|
|
$this->save($date);
|
|
}
|
|
return success();
|
|
}
|
|
|
|
/***
|
|
* @param $data
|
|
* @param $payInfo
|
|
* @param $site_id
|
|
* @param int $member_id
|
|
* @param string $rate
|
|
* @return array
|
|
*/
|
|
public function AlipaySave($data, $payInfo, $ag_site_id, $member_id = 0, $rate = '0.6',$saveData=[])
|
|
{
|
|
$datas = [
|
|
'merchant_name' => $data['alias_name'],
|
|
'contacts_name' => $data['contact_infos']['name'],
|
|
'contacts_phone' => $data['contact_infos']['mobile'],
|
|
'site_id' => $data['site_id'],
|
|
'ag_site_id' => $ag_site_id,
|
|
'ag_member_id' => $member_id,
|
|
'manage_id' => $data['manage_id'] ?? 0,
|
|
'pay_type' => 'alipay',
|
|
'rate' => $rate,
|
|
'subject_type' => $data['subject_type'],
|
|
'alipay_value' => $payInfo,
|
|
'business_code' => $data['business_code'],
|
|
'service_commission' => $data['service_commission'] ?? 0,
|
|
'isDrafts' => $data['isDrafts'],
|
|
'reg_money' => $data['reg_money'],
|
|
'apply_desc' => $data['apply_desc'] ?? '',
|
|
];
|
|
$datas=array_merge($datas,$saveData);
|
|
if ($data['shop_id'] > 0) {
|
|
$find = $this->where('shop_id', $data['shop_id'])->find();
|
|
} else {
|
|
$find = $this->where('business_code', $data['business_code'])->find();
|
|
}
|
|
if ($find) {
|
|
$find->save($datas, true);
|
|
$shop_id = $find['shop_id'];
|
|
} else {
|
|
$this->save($datas, true);
|
|
$shop_id = $this->shop_id;
|
|
}
|
|
return success(0, '' ,$shop_id);
|
|
}
|
|
}
|