<?php
/**
* 接口文件 mold.inc.php tag.inc.php
* 2018--10-19
*/
include_once '../addons/sister_renovation/sms.php';
define('QRCODEPATH','/addons/sister_renovation/public/qrcode/');
class Sister_renovationModuleWxapp extends WeModuleWxapp {
public $adv = 'sis_adv';//广告
public $adv_group = 'sis_adv_group';//广告组
public $classify = 'sis_article_classify';//文章分类
public $info = 'sis_article_info';//文章详情
public $bespeak = 'sis_bespeak';//预约内容
public $case = 'sis_case';//案例
public $config = 'sis_config';//配置表
public $designer_info = 'sis_designer_info';//设计师详情
public $level = 'sis_designer_level';//设计师等级
public $class = 'sis_site_class';//工地分类
public $construction = 'sis_site_construction';//工地
public $site_info = 'sis_site_info';//工地详情
public $inspection = 'sis_site_inspection';//工地查看表
public $sta_classify = 'sis_standard_classify';//装修标准分类
public $standard_info = 'sis_standard_info';//装修标准详情
public $tag = 'sis_tag';//标签
public $form = 'sis_form_conifg';//表单
public $vr = 'sis_vr';//vr
public $temp = 'sis_temp';//模板
public $page = 'sis_page';//模板详细内容
public $tag_des = 'sis_case_tag_des';//模板详细内容
public $site = 'sis_site';//模板详细内容
public $member = 'sis_member';//用户信息
public $list = 'sis_standard_list';//单页列表详情
public $res = 'sis_residential';//小区
public $coller = 'sis_coller_case';//收藏案列
public $marketing = 'sis_marketing';//计算器和0元设计
public $preson = 'sis_preson';//个人中心导航
public $comment = 'sis_site_comment';//个人中心导航
//新增
public $content = 'sis_content';//图文
public $content_class = 'sis_content_class';//图文分类
public $address = 'sis_address';//用户注册表
public $follows = 'sis_site_follows';//用户关注工地关系表
public $sis_weid,$http,$https;
public $pageindex = 10;
public function __construct(){
global $_W,$_GPC;
$is = $this->data_sy();
if($is != -1 && !empty($is)){
$this->sis_weid = $this->synchronization($is);
}else{
$this->sis_weid = $_W['uniacid'];
}
$this->https = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 'https://' : 'http://';
}
/*
* 根据name获取配置信息
* @param $name 配置名
* return array
*/
public function sc($name){
global $_W;
if(empty($name)){
return '';
}
$info = pdo_get($this->config,['name'=>$name,'weid'=>$_W['uniacid']]);
return $info['value'];
}
public function data_sy($name = 'data_ys'){
global $_W;
$sisconfig = pdo_get("sis_config",array('weid'=>$_W['uniacid'],'name'=>$name));
return $sisconfig['value'];
}
/**
* 授权接口
*/
public function doPageauthorization(){
$is = json_encode(['code'=>1,'msg'=>'11111']);
$callback = $_GET['callback'];
if(empty($callback)){
echo $is;exit;
}else{
exit($callback."($is)");
}
}
/**
* 预约短信发送
*/
public function sms_sending($mobile,$content){
global $_W,$_GPC;
// 获取配置信息
$smsvar = $this->sc('sms_var');
// $mobile = $this->sc('mobile');//管理员电话号码
$status = FALSE;
// 是否开启短信
if($this->sc('sms_status') == 2){
// 未启用短信
}else{
$code = $this->sc('sms_code');//哪家短信
$data = [];
$data['sms_key'] = $this->sc('sms_key');
$data['sms_serect'] = $this->sc('sms_serect');
$data['sms_id'] = $this->sc('sms_id');
$data['sms_var'] = $this->sc('sms_var');
$data['sms_sign'] = $this->sc('sms_sign');
$sms = new Sms();
if($code == 1){
//阿里短信
$info = $sms->alicloud($mobile,$data,$content);
if($info['Message'] == 'OK' && $info['Code'] == 'OK'){
//发送成功
$status = true;
}
}else if($code == 2){
//创瑞的了
$info = $sms->chui($mobile,$data,$content);
if($info['code'] == 0){
//发送成功
$status = true;
}
}
}
return $status;
}
/**
* 注册短信发送
*/
public function sms_sending_register($mobile,$content){
global $_W,$_GPC;
// 获取配置信息
$smsvar = $this->sc('sms_var_register');
// $mobile = $this->sc('mobile');//管理员电话号码
$status = FALSE;
// 是否开启短信
if($this->sc('sms_status_register') == 2){
$this->result('0','未启用短信注册',['status'=>0,'message'=>'未启用短信注册']);
}else{
$code = $this->sc('sms_code_register');//哪家短信
$data = [];
$data['sms_key'] = $this->sc('sms_key_register');
$data['sms_serect'] = $this->sc('sms_secret_register');
$data['sms_id'] = $this->sc('sms_id_register');
$data['sms_var'] = $this->sc('sms_var_register');
$data['sms_sign'] = $this->sc('sms_sign_register');
$sms = new Sms();
if($code == 1){
//阿里短信
$info = $sms->alicloud($mobile,$data,$content);
if($info['Message'] == 'OK' && $info['Code'] == 'OK'){
//发送成功
$status = true;
}
}
}
return $status;
}
//数组去重复
private function arr($arr){
foreach($arr[0] as $k => $v){
$arr_inner_key[]= $k; //先把二维数组中的内层数组的键值记录在在一维数组中
}
foreach ($arr as $k => $v){
$v =join(",",$v); //降维 用implode()也行
$temp[$k] =$v; //保留原来的键值 $temp[]即为不保留原来键值
}
$temp =array_unique($temp); //去重:去掉重复的字符串
foreach ($temp as $k => $v){
$a = explode(",",$v); //拆分后的重组 如:Array( [0] => james [1] => 30 )
$arr_after[$k]= array_combine($arr_inner_key,$a); //将原来的键与值重新合并
}
return $arr_after;
}
/**
* 注册用户获取手机验证码
*/
public function doPageGetcode(){
global $_W,$_GPC;
$result = pdo_get($this->member,array('phone'=>$_GPC['phone'],'status'=>0,'weid'=>$this->sis_weid));
if(!empty($result)){
$this->result('0','该手机号已被注册!',['status'=>1,'message'=>'该手机号已被注册!']);
}else{
$_W['verifyCode'] = mt_rand(99999,999999);
$ret = $this->sms_sending_register($_GPC['phone'],array('0'=>$_W['verifyCode']));
if ($ret){
$this->result('0','验证码已发送',['status'=>0,'message'=>'验证码已发送','verifyCode'=>$_W['verifyCode']]);
}else{
$this->result('0','验证码发送失败',['status'=>2,'message'=>'验证码发送失败']);
}
}
}
/**
*注册用户,通过openid绑定
*/
public function doPageRegister(){
global $_W,$_GPC;
$openid = $_GPC['openid'];
if(empty($openid) || $openid == null){
$this->result(0,'',['status'=>2,'message'=>'请先授权']);
}
$member = pdo_get($this->member,array('openid'=>$openid),array('id'));
if(empty($member)) {
$this->result(0,'',['status'=>2,'message'=>'请先授权!']);
}
$code = $_GPC['code'];
$submit_time = $_W['timestamp'];
$data['name'] = $_GPC['name'];
$data['phone'] = $_GPC['phone'];
$data['address'] = $_GPC['address'];
$data['room'] = $_GPC['room'];
$data['r_time'] = time();
try{
评论3
最新资源