<?php
/*
 +----------------------------------------------------------------------
 | TEMMOKUMVC [ NO BEST , ONLY BETTER ]
 +----------------------------------------------------------------------
 | Copyright (c) 2018~2019 https://www.temmoku.cn All rights reserved.
 +----------------------------------------------------------------------
 | Author: 张宗强 Email:webmaster@temmoku.cn QQ:158726877 516669373 TEL:17895221001 微信:temmokumvc
 +---------------------------------------------------------------------- 
*/
namespace plugin\wechat\admin\controller;
use \temmoku\db;
use \temmoku\controller;
use \temmoku\lib\pages;
use \plugin\wechat\lib\common;
class kf extends controller{
	
	public function set(){
		
		$this->display(tpl('kf/set'));
	}
	//添加客服账号
	public function add(){
		/* if($_POST['step']=='post'){
			$row=db::select('*')->from(jab.'user')->where("uid= '$_POST[uid]' ")->row();
			if(!$row || !$row['wechat_openid']){
				$this->err('不存在的用户，或者没有绑定微信账号');
			}
			$_data=[
				'kf_account'=>$_POST['kf_account'].'@'.C('Wechat|Wechat.appid'),
				//'kf_nick'=>$_POST['nickname'],
				//'kf_id'=>$_POST['kf_id'],
				'nickname'=>$_POST['nickname'],
				'password'=>MD5($_POST['password']),
				//'media'=>'filename'
			];
			$access_token=(new common)->Get_Token();
			$url="https://api.weixin.qq.com/customservice/kfaccount/add?access_token=".$access_token;
			$res=http_request($url,$_data);
			if($res['errcode']=='0'){
				$sql=[
					'uid'=>$_POST['uid'],
					'kf_account'=>$_POST['kf_account'],
					'kf_id'=>$_POST['kf_id'],
					'nickname'=>$_POST['nickname'],
					'password'=>MD5($_POST['password']),
				];
				db::insert('Persons')->cols($sql)->query();
				$this->success('客服设置成功');
			}ELSE{
				$this->err(C('wechat|errcode.'.$res['errcode']));
			}
		} */
	}
}
?>