158 lines
6.0 KiB
PHP
158 lines
6.0 KiB
PHP
<?php
|
|
/**
|
|
* SAAS应用系统 --- 十年开发经验汇集巨献!
|
|
* ==========================================================
|
|
* Copy right 2020-2050 成都众联思索科技有限公司,保留所有权利。
|
|
* ----------------------------------------------------------
|
|
* 官方网址: https://www.zoomtk.com
|
|
* 这不是自由软件!未经允许不得用于商业目或程序代码摘取及修改。
|
|
* 任何企业和个人未经允许对程序代码以任何形式任何目的再发布传播。
|
|
* 唯一发布渠道www.zoomtk.com;非官方渠道统一视为侵权行为。
|
|
* ==========================================================
|
|
*/
|
|
namespace addon\saas\shop\controller;
|
|
use addon\saas\model\AppletReg;
|
|
class Mincode extends SaasBase
|
|
{
|
|
public function lists()
|
|
{
|
|
if (request()->isAjax()) {
|
|
$Applet = new AppletReg();
|
|
$search_text = input('search_text', '');
|
|
$page = input('page', 1);
|
|
$page_size = input('page_size', PAGE_LIST_ROWS);
|
|
$condition[] = ['ag_site_id', '=', $this->site_id];
|
|
if ($search_text) {
|
|
$condition[] = ['app_name|contact_phone|legal_persona_name|value', 'like', '%' . $search_text . '%'];
|
|
}
|
|
$field='id,site_id,corporate_name,app_type,reg_fee,legal_persona_name,legal_persona_wechat,contact_phone,app_name,status,appid,create_time';
|
|
$res = $Applet->getPageList($condition, $page, $page_size,$field);
|
|
return $res;
|
|
}
|
|
$this->assign('money',$this->AgentInfo['agent_money']);
|
|
return $this->fetch('mini/lists');
|
|
}
|
|
|
|
/***
|
|
* 删除未注册成功的
|
|
* @return array|void
|
|
*/
|
|
public function codereg()
|
|
{
|
|
$id = input('id');
|
|
$Applet = new AppletReg();
|
|
if (request()->isAjax()) {
|
|
$data = request()->post();
|
|
$data['ag_site_id'] = $this->site_id;
|
|
$data['user_id'] = $this->uid;
|
|
unset($data['file'], $data['appType']);
|
|
$appType = input('appType');
|
|
$business_code = input('business_code');
|
|
if (!$id && $appType) { //新注册
|
|
$res = [];
|
|
$message='';
|
|
foreach ($appType as $item) {
|
|
$data['app_type'] = $item;
|
|
switch ($item) {
|
|
case 'weapp':
|
|
$reg = $Applet->RegWeapp('we' . $business_code, $data);
|
|
if ($reg['code'] <= 0) {
|
|
$message = '微信小程序提交成功'."\n";
|
|
} else {
|
|
$message = '微信' . $reg['message']."\n";
|
|
}
|
|
break;
|
|
case 'aliapp':
|
|
$reg = $Applet->RegAliapp('ali' . $business_code, $data);
|
|
if ($reg['code'] <= 0) {
|
|
$message .= '支付宝小程序提交成功';
|
|
} else {
|
|
$message .= '支付宝' . $reg['message'];
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
} else if ($id) {
|
|
$app_type = input('app_type');
|
|
switch ($app_type) {
|
|
case 'weapp':
|
|
$res = $Applet->RegWeapp($business_code, $data);
|
|
break;
|
|
case 'aliapp':
|
|
$res = $Applet->RegAliapp($business_code, $data);
|
|
break;
|
|
}
|
|
}
|
|
$res['message']=$message;
|
|
return $res;
|
|
}
|
|
$info = [];
|
|
$business_code = date('YmdHis');
|
|
if ($id) {
|
|
$info = $Applet->where('a.id', '=', $id)->alias('a')
|
|
->join('site s', 'a.site_id=s.site_id', 'left')
|
|
->field('a.*,s.username')->find();
|
|
$siteInfo = [
|
|
'site_id' => $info['site_id'],
|
|
'username' => $info['username'],
|
|
];
|
|
$this->assign('siteInfo', $siteInfo);
|
|
$this->assign('app_type', $info->getData('app_type'));
|
|
}
|
|
$this->assign('info', $info);
|
|
$this->assign('id', $id);
|
|
$this->assign('business_code', $business_code);
|
|
return $this->fetch('mini/regcode');
|
|
}
|
|
|
|
public function delreg()
|
|
{
|
|
$id = input('id');
|
|
$Applet = new AppletReg();
|
|
if (request()->isAjax()) {
|
|
$res = $Applet->where('id', '=', $id)->where('ag_site_id', '=', $this->site_id)->delete();
|
|
return success(0, '成功');
|
|
}
|
|
}
|
|
|
|
/***
|
|
* 刷新状态
|
|
* @return array
|
|
*/
|
|
public function refresh(){
|
|
$id=input('id');
|
|
$Applet = new AppletReg();
|
|
return success(0,'成功');
|
|
}
|
|
|
|
|
|
/***
|
|
* 快速注册小程序
|
|
* @return array|mixed
|
|
*/
|
|
public function aliding(){
|
|
if(request()->isAjax()){
|
|
$miapp = new \addon\saas\model\AppletReg();
|
|
$site_id=input('site_id');
|
|
$data['business_code'] = date('YmdHis');
|
|
$data['site_id'] = $site_id;
|
|
$data['ag_site_id'] = $this->site_id;
|
|
$data['app_type'] = 'aliapp';
|
|
$data['corporate_name'] =input('corporate_name');
|
|
$data['legal_persona_name'] =input('contact_name');
|
|
$data['contact_phone'] = input('contact_phone');
|
|
$data['app_name'] = input('app_name');
|
|
$data['status'] = 'reg';
|
|
$res= $miapp->save($data);
|
|
if($res){
|
|
$id = config('alipay.service_id'); //'CM010301000000053263';
|
|
$business_code=$data['business_code'];
|
|
$url = "https://b.alipay.com/page/fw-portal/itemQrCodeToIsv?marketCode=OFFLINE_PROMOTION&merchandiseId={$id}&ticket={$business_code}&appName={$data['app_name']}";
|
|
return success(0,'成功',$url);
|
|
}else{
|
|
return error();
|
|
}
|
|
}
|
|
return $this->fetch('mini/alipay');
|
|
}
|
|
} |