namespace app\recruitcard\service;
use app\common\base\service\BaseService;
use app\library\ErrorCode;
use app\model\ShopStaffInfo;
use doushen\frame\ResponseBath;
use phpDocumentor\Reflection\Types\Integer;
use Yii;
use doushen\request\Http;
class RecruitStaffService extends BaseService
{
const STAFF_STATUS = 2;
const STAFF_SOURCE_SCHOOL = 1;
const STAFF_SOURCE_ORGAN = 2;
const STAFF_SOURCE_JOIN = 4;
const STAFF_TITLE_COMMON = 3;
const STAFF_CODE_STYLE_1 = 1;
const STAFF_CODE_STYLE_2 = 2;
const STAFF_CODE_STYLE_3 = 3;
const STAFF_CODE_STYLE_4 = 4;
const STAFF_CODE_STYLE_5 = 5;
const STAFF_CODE_STYLE_6 = 6;
const STAFF_CODE_STYLE_SA_1 = 1;
const STAFF_CODE_STYLE_SA_2 = 2;
const ORGAN_CODE_STYLE_1 = 1;
const ORGAN_CODE_STYLE_2 = 2;
const ORGAN_CODE_STYLE_3 = 3;
const ORGAN_CODE_STYLE_4 = 4;
const ORGAN_CODE_STYLE_5 = 5;
const ORGAN_CODE_STYLE_6 = 6;
const ORGAN_CODE_STYLE_7 = 7;
const ORGAN_CODE_STYLE_8 = 8;
const ORGAN_CODE_STYLE_9 = 9;
const ORGAN_CODE_STYLE_10 = 10;
const ORGAN_FLAG_KAISA = 10001;
const ORGAN_FLAG_CCT_BJ = 10002;
const ORGAN_FLAG_CCT_JS = 10003;
const ORGAN_FLAG_CCT_QD = 10004;
const ORGAN_FLAG_CCT_HB = 10005;
const ORGAN_FLAG_CCT_JSU = 10006;
const ORGAN_FLAG_CCT_GL = 10007;
const ORGAN_FLAG_CCT_GX = 10008;
const ORGAN_FLAG_CCT_SC = 10009;
const ORGAN_FLAG_CCT_HN = 10010;
const ORGAN_FLAG_CCT_GZ = 10011;
const ORGAN_FLAG_CCT_ZJ = 10012;
const ORGAN_FLAG_CCT_XA = 10013;
const ORGAN_FLAG_CCT_GM = 10014;
const ORGAN_FLAG_CCT_SH = 10015;
const ORGAN_FLAG_CCT_GS = 10016;
const ORGAN_FLAG_CCT_AH = 10017;
const ORGAN_FLAG_CCT_HNA = 10018;
const ORGAN_FLAG_CCT_DL = 10019;
const ORGAN_FLAG_CCT_HLJ = 10020;
const ORGAN_FLAG_CCT_JX = 10021;
const ORGAN_FLAG_CCT_NX = 10022;
const ORGAN_FLAG_CCT_SD = 10023;
const ORGAN_FLAG_CCT_HUN = 10024;
const ORGAN_FLAG_CCT_SZ = 10025;
const ORGAN_FLAG_CCT_QH = 10026;
const ORGAN_FLAG_CCT_HUNX = 10027;
const ORGAN_FLAG_CCT_ST = 10028;
const ORGAN_FLAG_CCT_DG = 10029;
const ORGAN_FLAG_CCT_TJ = 10038;
const ORGAN_FLAG_CCT_XJ = 10054;
const ORGAN_FLAG_LUYIZAITU = 10030;
const ORGAN_FLAG_HELI = 10031;
const ORGAN_FLAG_XISHU = 10032;
const ORGAN_FLAG_DIERKETANG = 10033;
const ORGAN_FLAG_JIUFANG = 10034;
const ORGAN_FLAG_RULIN = 10035;
const ORGAN_FLAG_KANG = 10036;
const ORGAN_FLAG_DOUSHENSHUANGSHI = 10037;
const ORGAN_FLAG_KANGWEIXUETANG = 10039;
const ORGAN_FLAG_HOUDEIJY = 10040;
const ORGAN_FLAG_SUIXINKT = 10041;
const ORGAN_FLAG_LISICHENLIUXUE = 10042;
const ORGAN_FLAG_LISICHENMEITEJY = 10043;
const ORGAN_FLAG_LISICHENRTW_YXH = 10044;
const ORGAN_FLAG_LISICHENRTW_XEZ = 10045;
const ORGAN_FLAG_LISICHENRTW_TXH = 10046;
const ORGAN_FLAG_LISICHENRTW_WLWYJY = 10047;
const ORGAN_FLAG_LISICHENRTW_XJBNYC = 10048;
const ORGAN_FLAG_LISICHENQUYUFZ = 10049;
const ORGAN_FLAG_LISICHENJITUANZB = 10050;
const ORGAN_FLAG_LISICHENBAINIANYC = 10051;
const ORGAN_FLAG_LISICHENZONGBUKANGB = 10052;
const ORGAN_FLAG_LISICHENZONGBUNX = 10053;
const ORGAN_FLAG_LISICHENKUAXUEWANG = 10055;
const ORGAN_FLAG_LISICHENJTSHICHANGBU = 10056;
const ORGAN_FLAG_YIQI= 10057;
const ORGAN_FLAG_ZHONGQIAOGUOLV= 10058;
const ORGAN_FLAG_LISICHENHUIRONGEXUE= 10059;
const ORGAN_FLAG_GAINIANXING= 10060;
const ORGAN_FLAG_LAOJIN = 10061;
const ORGAN_FLAG_CAICAI = 10062;
const ORGAN_FLAG_ZJXT = 10063;
const ORGAN_ARRAY = array(10001,10002,10003,10004,10005,10006,10007,10008,10009,10010,10011,10012,10013,10014,10015,
10016,10017,10018,10019,10020,10021,10022,10023,10024,10025,10026,10027,10028,10029,10030,
10031,10032,10033,10034,10035,10036,10037,10038,10039,10040,10041,10042,10043,10044,10045,
10046,10047,10048,10049,10050,10051,10052,10053,10054,10055,10056,10057,10058,10059,10060,
10061,10062,10063);
const ORGAN_NO_DEPARTMENT_INITIAL_ARRAY = array(10001,10002,10003,10004,10005,10006,10007,10008,10009,10010,10011,10012,10013,10014,10015,
10016,10017,10018,10019,10020,10021,10022,10023,10024,10025,10026,10027,10028,10029,10030,
10031,10032,10033,10034,10035,10036,10037,10038,10039,10040,10041,10054,10057,10058,10060,10061,10062,10063);
const ORGAN_NO_DEPARTMENT_LATER_ARRAY = array(
10042,10043,10044,10045,10046,10047,10048,10053,10055,10056,10059
);
const ORGAN_DEPARTMENT_LATER_ARRAY = array(
10049,10050,10051,10052
);
const ORGAN_CHANNEL_ARRAY = array(
10047,10049,10050,10051,10052,10055,10056
);
const ORGAN_LONG_MAP_TIME = array(10062);
const ORGAN_DEPARTMENT_INFO = array(
self::ORGAN_FLAG_LISICHENQUYUFZ => array(
"总经办",
"综合管理部",
"项目实施部",
"外企与国际教育事业部",
"售前咨询部",
"区域教育事业部-鲁西南",
"区域教育事业部-华中",
"区域教育事业部-华南",
"区域教育事业部-华北",
"军校与集成事业部",
),
self::ORGAN_FLAG_LISICHENJITUANZB => array(
"总裁办",
"人力资源管理中心",
"财务管理中心",
"行政管理中心",
"物业管理中心",
"投资管理与金融合作部",
"战略与创新发展部",
"证券事务部",
"市场部",
"互联网运营部",
"风险管理部",
"公共关系部",
"信息安全集团",
),
self::ORGAN_FLAG_LISICHENBAINIANYC => array(
"市场部",
),
self::ORGAN_FLAG_LISICHENZONGBUKANGB => array(
"业务三部",
"业务四部",
"业务五部",
"业务六部",
"业务七部",
"业务八部",
"新渠道事业部",
"郑州分公司",
"天津分公司",
"上海分公司",
"济南分公司",
"南京分公司",
"成都分公司",
"西南大区",
),
);
const ORGAN_CCT_ARRAY = array(10002,10003,10004,10005,10006,10007,10008,10009,10010,10011,10012,10013,10014,10015,
10016,10017,10018,10019,10020,10021,10022,10023,10024,10025,10026,10027,10028,10029,10038,10054);
public static $name;
public static $city;
public static $city_id;
public static $campus;
public static $campus_id;
public static $staff_source;
public static $id;
public static $title;
private static $jiangsusanxiao = ['常熟分校','张家港分校','江阴分校'];
private static $special_school = ['台州分校','湘潭分校','长春分校'];
public static $second_id;
public static function checkStaff(int $tel, string $name ) {
$staff_info = ShopStaffInfo::find()->select('id,city,staff_source,city_id,campus,campus_id,title')
->where(['is_deleted'=>self::STAFF_STATUS,'tel'=>trim($tel),'name'=>trim($name)])->asArray()->one();
if (!$staff_info) {
return false;
}
self::$name = $name;
self::$city = $staff_info['city'];
self::$city_id = $staff_info['city_id'];
self::$campus = $staff_info['campus'];
self::$campus_id = $staff_info['campus_id'];
self::$staff_source = $staff_info['staff_source'];
self::$id = $staff_info['id'];
self::$title = $staff_info['title'];
return true;
}
public static function checkStaffWithSource(int $tel, string $name, int $staff_source ) {
$staff_info = ShopStaffInfo::find()->select('id,city,staff_source,city_id,campus,campus_id,title')
->where(['is_deleted'=>self::STAFF_STATUS,'tel'=>trim($tel),'name'=>trim($name), 'staff_source'=>$staff_source])->asArray()->one();
if (!$staff_info) {
return false;
}
self::$name = $name;
self::$city = $staff_info['city'];
self::$city_id = $staff_info['city_id'];
self::$campus = $staff_info['campus'];
self::$campus_id = $staff_info['campus_id'];
self::$staff_source = $staff_info['staff_source'];
self::$id = $staff_info['id'];
self::$title = $staff_info['title'];
return true;
}
public static function checkDistributestaff(int $tel, string $name ) {
$staff_info = ShopStaffInfo::find()->select('id,city,staff_source,city_id,campus,campus_id,title')
->where(['is_deleted'=>self::STAFF_STATUS,'tel'=>trim($tel),'name'=>trim($name),"staff_source"=>100001])->asArray()->one();
if (!$staff_info) {
return false;
}
self::$name = $name;
self::$city = $staff_info['city'];
self::$city_id = $staff_info['city_id'];
self::$campus = $staff_info['campus'];
self::$campus_id = $staff_info['campus_id'];
self::$staff_source = $staff_info['staff_source'];
self::$id = $staff_info['id'];
self::$title = $staff_info['title'];
return true;
}
public static function CheckOrgan (int $tel, string $name,int $organ,int $second,string $second_name, string $department)
{
$where = ['is_deleted'=>self::STAFF_STATUS,'tel'=>trim($tel),'staff_source'=>$organ];
if ($department) {
$data['org_department'] = trim($department);
}
$staff_info = ShopStaffInfo::find()->select('id,staff_source')
->where($where)->asArray()->one();
if ($staff_info) {
$data['name'] = $name;
ShopStaffInfo::getDb()->createCommand()->update(ShopStaffInfo::tableName(), $data,
'id = ' . $staff_info['id'] )->execute();
} else {
$data['name'] = $name;
$data['staff_source'] = $organ;
$data['tel'] = trim($tel);
ShopStaffInfo::getDb()->createCommand()->insert(ShopStaffInfo::tableName(),
$data)->execute();
$staff_info = ShopStaffInfo::find()->select('id,staff_source')
->where($where)->asArray()->one();
}
if ($second) {
$second_info = ShopStaffInfo::find()->select('id,staff_source')
->where(['name'=>$second_name,'from_staff_id'=>$staff_info['id']])->asArray()->one();
if (!$second_info) {
ShopStaffInfo::getDb()->createCommand()->insert(ShopStaffInfo::tableName(),
['name'=>$second_name,'from_staff_id'=>$staff_info['id'],'staff_source'=>$organ])->execute();
$second_info = ShopStaffInfo::find()->select('id,staff_source')
->where(['name'=>$second_name,'from_staff_id'=>$staff_info['id']])->asArray()->one();
}
self::$second_id = $second_info['id'];
}
}
public static function chekSecond (int $tel, string $name,int $organ,int $second,string $second_name, string $department)
{
$where = ['is_deleted'=>self::STAFF_STATUS,'tel'=>trim($tel),'staff_source'=>$organ];
if ($department) {
$data['org_department'] = trim($department);
}
$staff_info = ShopStaffInfo::find()->select('id,staff_source')
->where($where)->asArray()->one();
if (!$staff_info) {
return false;
}
if ($second) {
$second_info = ShopStaffInfo::find()->select('id,staff_source')
->where(['name'=>$second_name,'from_staff_id'=>$staff_info['id']])->asArray()->one();
if (!$second_info) {
ShopStaffInfo::getDb()->createCommand()->insert(ShopStaffInfo::tableName(),
['name'=>$second_name,'from_staff_id'=>$staff_info['id'],'staff_source'=>$organ])->execute();
$second_info = ShopStaffInfo::find()->select('id,staff_source')
->where(['name'=>$second_name,'from_staff_id'=>$staff_info['id']])->asArray()->one();
}
self::$second_id = $second_info['id'];
}
return true;
}
public static function get_qr_code($tel, int $action)
{
if ($action == self::STAFF_CODE_STYLE_1) {
$code_x = 586; $code_y = 2930;
$text1_x = 20; $text1_y = 2950;
$text2_x = 20; $text2_y = 2992;
$text3_x = 20; $text3_y = 3032;
$red = 255; $green = 255; $blue = 255;
$imagePath = '/library/gentlemanImg/staff1.png';
} elseif ($action == self::STAFF_CODE_STYLE_2) {
$code_x = 586; $code_y = 3150;
$text1_x = 20; $text1_y = 3170;
$text2_x = 20; $text2_y = 3212;
$text3_x = 20; $text3_y = 3252;
$red = 0; $green = 0; $blue = 0;
$imagePath = '/library/gentlemanImg/staff2.png';
}elseif ($action == self::STAFF_CODE_STYLE_3) {
$code_x = 586; $code_y = 2730;
$text1_x = 20; $text1_y = 2750;
$text2_x = 20; $text2_y = 2792;
$text3_x = 20; $text3_y = 2832;
$red = 0; $green = 0; $blue = 0;
$imagePath = '/library/gentlemanImg/staff3.png';
}elseif ($action == self::STAFF_CODE_STYLE_4) {
$code_x = 586; $code_y = 2730;
$text1_x = 25; $text1_y = 2750;
$text2_x = 25; $text2_y = 2792;
$text3_x = 25; $text3_y = 2832;
$red = 0; $green = 0; $blue = 0;
$imagePath = '/library/gentlemanImg/staff4.png';
}elseif ($action == self::STAFF_CODE_STYLE_5) {
$code_x = 586; $code_y = 3230;
$text1_x = 20; $text1_y = 3250;
$text2_x = 20; $text2_y = 3292;
$text3_x = 20; $text3_y = 3332;
$red = 0; $green = 0; $blue = 0;
$imagePath = '/library/gentlemanImg/staff5.png';
}elseif ($action == self::STAFF_CODE_STYLE_6){
$code_x = 586; $code_y = 2930;
$text1_x = 20; $text1_y = 2950;
$text2_x = 20; $text2_y = 2992;
$text3_x = 20; $text3_y = 3032;
$text4_x = 20; $text4_y = 3072;
$red = 255; $green = 255; $blue = 255;
$imagePath = '/library/gentlemanImg/staff6.png';
} else {
return ['check' => false,'data' => '生成二维码底图参数错误'];
}
if (in_array(trim(self::$city),self::$jiangsusanxiao) ) {
self::$city_id = 1003;
} elseif (in_array(trim(self::$city),self::$special_school) ) {
self::$city_id = 1002;
} elseif (mb_substr(self::$city,-2,2) == "分校" && !self::$city_id) {
self::$city_id = 1002;
}
$path = '/tmp/recruitcard';
if (self::$staff_source != self::STAFF_SOURCE_SCHOOL) {
if (self::$staff_source == self::STAFF_SOURCE_JOIN) {
$url = "https://bm.zhugexuetang.com?school_id=".self::$city_id."&fromEntrance=2&entrance=2&staff_code=";
$text = '大语文'.str_replace('分校','',self::$city).self::$campus.'诚挚为您推荐';
} else {
$url = "https://bm.zhugexuetang.com?fromEntrance=1&entrance=2&staff_code=";
$text = self::$name.'诚挚为您推荐豆神大语文';
}
} else {
if (self::$title == self::STAFF_TITLE_COMMON) {
if (mb_substr(self::$city,-2,2) == "分校") {
$url = "https://bm.zhugexuetang.com?school_id=".self::$city_id."&fromEntrance=2&entrance=2&staff_code=";
$text = '我是'.self::$name.'老师,很荣幸为您推荐';
} else {
$url = "https://bm.zhugexuetang.com?fromEntrance=1&entrance=2&staff_code=";
$text = '我是'.self::$name.'老师,很荣幸为您推荐';
}
} else {
if (mb_substr(self::$city,-2,2) == "分校") {
$url = "https://bm.zhugexuetang.com?school_id=".self::$city_id."&fromEntrance=2&entrance=2&staff_code=";
$text = '我是'.self::$name.'老师,很荣幸为您推荐';
} else {
$url = "https://bm.zhugexuetang.com?fromEntrance=1&entrance=2&staff_code=";
$text = '我是'.self::$name.'老师,很荣幸为您推荐';
}
}
}
if($action == self::STAFF_CODE_STYLE_6){
$url = "https://m.zhugexuetang.com/zgxt_vip?source=135&staff_code=";
}
$code = self::get_qr_tel($tel);
$staff_code = self::$staff_source.'_'.self::$city_id.'_'.self::$campus_id.'_'.$code;
self::updateInfoData(['code'=>$staff_code],['id'=>self::$id]);
if (!is_dir($path)) {
@mkdir($path);
}
include(ROOT_PATH . '/library/phpqrcode/qrlib.php');
$qrcodePath = $path . '/' . $tel . '.png';
\QRcode::png($url.$staff_code, $qrcodePath, 3, 2);
$dst = (ROOT_PATH . $imagePath);
$dst_im1 = imagecreatefrompng($dst);
$dst_info1 = getimagesize($dst);
$src1 = $qrcodePath;
$src1_im = imagecreatefrompng($src1);
$src1_info = getimagesize($src1);
imagecopymerge($dst_im1,$src1_im,$code_x,$code_y,0,0,$src1_info[0],$src1_info[1],100);
$path = '/tmp/gentlemancard';
if (!is_dir($path)) {
@mkdir($path);
}
$poster_marge_path =$path . '/' . date('Y-m-d').'-'.$tel . '.png';
ob_start();
imagepng($dst_im1,$poster_marge_path);
imagedestroy($dst_im1);
imagedestroy($src1_im);
$dst_path = $poster_marge_path;
$dst_new = imagecreatefromstring(file_get_contents($dst_path));
$font = (ROOT_PATH . '/library/gentlemanImg/fzlthk.ttf');
$im = imagecreatetruecolor(400, 30);
$colour =imagecolorallocate($im, $red,$green,$blue);
$size = 20;
if (mb_strlen($text) > 16) {
$size = 15;
}
imagefttext($dst_new, $size, 0,$text1_x, $text1_y, $colour, $font, $text);
if($action == self::STAFF_CODE_STYLE_6){
imagefttext($dst_new, $size, 0,$text2_x, $text2_y, $colour, $font, '诸葛学堂会员大礼包');
imagefttext($dst_new, $size, 0,$text3_x, $text3_y, $colour, $font, '愿你畅游文化世界');
imagefttext($dst_new, $size, 0,$text4_x, $text4_y, $colour, $font, '扫描右方二维码即可购买');
}else{
imagefttext($dst_new, $size, 0,$text2_x, $text2_y, $colour, $font, '扫描右方二维码会看到');
imagefttext($dst_new, $size, 0,$text3_x, $text3_y, $colour, $font, '最适合您孩子的1~4个班级');
}
header('Content-type: image/png');
imagepng($dst_new);
@unlink($dst_new);
$sImage = ob_get_contents();
ob_end_clean();
$base64_img = base64_encode($sImage);
@unlink($qrcodePath);
return ['check' => true,'data' => $base64_img];
}
public static function get_dr_code($tel)
{
$code_x = 521; $code_y = 1188;
$imagePath = '/library/gentlemanImg/distribute99.png';
$path = '/tmp/recruitcarddistribute';
$url = "https://jm.doushen.com/activity/99list?school_id=".self::$city_id."&fromEntrance=3&entrance=3&staff_code=";
$code = self::get_qr_tel($tel);
$staff_code = self::$staff_source.'_'.self::$city_id.'_'.self::$campus_id.'_'.$code;
self::updateInfoData(['code'=>$staff_code],['id'=>self::$id]);
if (!is_dir($path)) {
@mkdir($path);
}
include(ROOT_PATH . '/library/phpqrcode/qrlib.php');
$qrcodePath = $path . '/' . $tel . '.png';
\QRcode::png($url.$staff_code, $qrcodePath, 3, 2);
$dst = (ROOT_PATH . $imagePath);
$dst_im1 = imagecreatefrompng($dst);
$dst_info1 = getimagesize($dst);
$src1 = $qrcodePath;
$src1_im = imagecreatefrompng($src1);
$src1_info = getimagesize($src1);
imagecopymerge($dst_im1,$src1_im,$code_x,$code_y,0,0,$src1_info[0],$src1_info[1],100);
$path = '/tmp/distribute';
if (!is_dir($path)) {
@mkdir($path);
}
$poster_marge_path =$path . '/' . date('Y-m-d').'-'.$tel . '.png';
ob_start();
imagepng($dst_im1,$poster_marge_path);
imagedestroy($dst_im1);
imagedestroy($src1_im);
$dst_path = $poster_marge_path;
$dst_new = imagecreatefromstring(file_get_contents($dst_path));
header('Content-type: image/png');
imagepng($dst_new);
@unlink($dst_new);
$sImage = ob_get_contents();
ob_end_clean();
$base64_img = base64_encode($sImage);
@unlink($qrcodePath);
return ['check' => true,'data' => $base64_img];
}
public static function get_sa_qr_code($tel, $name = '', $organ, $action, $second)
{
if ($action == self::STAFF_CODE_STYLE_SA_1) {
$code_xy = "231,450";
$imagePath = '/library/sa_distribute_2020/sadistribute2.png';
$url = "https://bm.zhugexuetang.com?school_id=".self::$city_id."&fromEntrance=4&entrance=4&staff_code=";
$text = [$name];
$textCoordinates = ['325,357'];
$color = '116,87,58';
$size = 25;
$code_level = 5;
} elseif ($action == self::STAFF_CODE_STYLE_SA_2) {
$code_xy = "231,450";
$imagePath = '/library/sa_distribute_2020/sadistribute1.png';
$url = "https://jm.doushen.com/activity/99newlist?school_id=".self::$city_id."&fromEntrance=4&entrance=4&staff_code=";
$text = [$name];
$textCoordinates = ['325,357'];
$color = '116,87,58';
$size = 25;
$code_level = 4;
}
$code = self::get_qr_tel($tel);
$organ_code = $organ.'_0_0_'.$code;
if ($second) {
$organ_code = $organ_code.':'.self::$second_id;
}
if ($second) {
$staff_info = ShopStaffInfo::find()->select('id')
->where(['is_deleted'=>self::STAFF_STATUS,'id'=>self::$second_id])->asArray()->one();
} else {
$staff_info = ShopStaffInfo::find()->select('id')
->where(['is_deleted'=>self::STAFF_STATUS,'tel'=>trim($tel),'staff_source'=>$organ])->asArray()->one();
}
self::updateInfoData(['code'=>$organ_code],['id'=>$staff_info['id']]);
$url .= $organ_code;
$return = self::CreatCard($url,$imagePath,$code_xy,$text,$textCoordinates,$color,$size,$code_level);
if ($return['check'] == false) {
return false;
}
return $return;
}
public static function get_organ_card ($tel, int $action,$organ,$name,$second,$second_name) {
if ($organ == self::ORGAN_FLAG_KAISA) {
$fileCata = "kaisa";
$text = [
'战略合作伙伴凯撒旅游'.$name,
'愿您足不出户纵览文学世界',
'停课不停学,学好大语文,做有修养的中国人',
'扫描右方二维码会看到最适合您孩子的1~4个班级'
];
if ($action == self::ORGAN_CODE_STYLE_6) {
$text = [
"战略合作伙伴凯撒旅游".$name,
'诚挚为您推荐诸葛学堂会员大礼包',
'愿你畅游文化世界',
'扫描右方二维码即可购买'
];
$newUrl = 'https://m.zhugexuetang.com/zgxt_vip?source=120';
}
} elseif (in_array($organ,self::ORGAN_CCT_ARRAY)) {
if ($organ == self::ORGAN_FLAG_CCT_BJ) {
$organ_name = '北京';
} elseif ($organ == self::ORGAN_FLAG_CCT_JS) {
$organ_name = '集善';
} elseif ($organ == self::ORGAN_FLAG_CCT_QD) {
$organ_name = '青岛';
} elseif ($organ == self::ORGAN_FLAG_CCT_HB) {
$organ_name = '湖北';
} elseif ($organ == self::ORGAN_FLAG_CCT_JSU) {
$organ_name = '江苏';
} elseif ($organ == self::ORGAN_FLAG_CCT_GL) {
$organ_name = '桂林';
} elseif ($organ == self::ORGAN_FLAG_CCT_GX) {
$organ_name = '广西';
} elseif ($organ == self::ORGAN_FLAG_CCT_SC) {
$organ_name = '四川';
} elseif ($organ == self::ORGAN_FLAG_CCT_HN) {
$organ_name = '海南';
} elseif ($organ == self::ORGAN_FLAG_CCT_GZ) {
$organ_name = '贵州';
} elseif ($organ == self::ORGAN_FLAG_CCT_ZJ) {
$organ_name = '浙江';
} elseif ($organ == self::ORGAN_FLAG_CCT_XA) {
$organ_name = '西安';
} elseif ($organ == self::ORGAN_FLAG_CCT_GM) {
$organ_name = '昆明';
} elseif ($organ == self::ORGAN_FLAG_CCT_SH) {
$organ_name = '上海';
} elseif ($organ == self::ORGAN_FLAG_CCT_GS) {
$organ_name = '甘肃';
} elseif ($organ == self::ORGAN_FLAG_CCT_AH) {
$organ_name = '安徽';
} elseif ($organ == self::ORGAN_FLAG_CCT_HNA) {
$organ_name = '河南';
} elseif ($organ == self::ORGAN_FLAG_CCT_DL) {
$organ_name = '大连';
} elseif ($organ == self::ORGAN_FLAG_CCT_HLJ) {
$organ_name = '黑龙江';
} elseif ($organ == self::ORGAN_FLAG_CCT_JX) {
$organ_name = '江西';
} elseif ($organ == self::ORGAN_FLAG_CCT_NX) {
$organ_name = '宁夏';
} elseif ($organ == self::ORGAN_FLAG_CCT_SD) {
$organ_name = '山东';
} elseif ($organ == self::ORGAN_FLAG_CCT_HUN) {
$organ_name = '湖南';
} elseif ($organ == self::ORGAN_FLAG_CCT_SZ) {
$organ_name = '深圳';
} elseif ($organ == self::ORGAN_FLAG_CCT_QH) {
$organ_name = '青海';
} elseif ($organ == self::ORGAN_FLAG_CCT_HUNX) {
$organ_name = '湖南新康辉国旅';
} elseif ($organ == self::ORGAN_FLAG_CCT_ST) {
$organ_name = '汕头';
} elseif ($organ == self::ORGAN_FLAG_CCT_DG) {
$organ_name = '东莞';
} elseif ($organ == self::ORGAN_FLAG_CCT_TJ){
$organ_name = "天津";
} elseif ($organ == self::ORGAN_FLAG_CCT_XJ){
$organ_name = "新疆";
}
$fileCata = "CCT";
$text = [
$organ_name.'康辉旅游'.$name,
'愿您足不出户纵览文学世界',
'停课不停学,学好大语文,做有修养的中国人',
'扫描右方二维码会看到最适合您孩子的1~4个班级'
];
if ($organ == self::ORGAN_FLAG_CCT_HUNX) {
$text = [
$organ_name.$name,
'愿您足不出户纵览文学世界',
'停课不停学,学好大语文,做有修养的中国人',
'扫描右方二维码会看到最适合您孩子的1~4个班级'
];
}
if ($action == self::ORGAN_CODE_STYLE_6) {
$text = [
$organ_name."康辉旅游".$name,
'诚挚为您推荐诸葛学堂会员大礼包',
'愿你畅游文化世界',
'扫描右方二维码即可购买'
];
if ($organ == self::ORGAN_FLAG_CCT_HUNX) {
$text = [
$organ_name.$name,
'诚挚为您推荐诸葛学堂会员大礼包',
'愿你畅游文化世界',
'扫描右方二维码即可购买'
];
}
$newUrl = 'https://m.zhugexuetang.com/zgxt_vip?source=121';
}
} elseif ($organ == self::ORGAN_FLAG_LUYIZAITU) {
$fileCata = "luyizaitu";
$text = [
'路易在途'.$name,
'愿您足不出户纵览文学世界',
'停课不停学,学好大语文,做有修养的中国人',
'扫描右方二维码会看到最适合您孩子的1~4个班级'
];
if ($action == self::ORGAN_CODE_STYLE_6) {
$text = [
"路易在途".$name,
'诚挚为您推荐诸葛学堂会员大礼包',
'愿你畅游文化世界',
'扫描右方二维码即可购买'
];
$newUrl = 'https://m.zhugexuetang.com/zgxt_vip?source=122';
}
} elseif ($organ == self::ORGAN_FLAG_HELI) {
$fileCata = "heli";
$text = [
'禾力旅行'.$name,
'愿您足不出户纵览文学世界',
'停课不停学,学好大语文,做有修养的中国人',
'扫描右方二维码会看到最适合您孩子的1~4个班级'
];
if ($action == self::ORGAN_CODE_STYLE_6) {
$text = [
"禾力旅行".$name,
'诚挚为您推荐诸葛学堂会员大礼包',
'愿你畅游文化世界',
'扫描右方二维码即可购买'
];
$newUrl = 'https://m.zhugexuetang.com/zgxt_vip?source=123';
}
} elseif ($organ == self::ORGAN_FLAG_XISHU) {
$fileCata = "other";
$text = [
'義学书院'.$name,
'愿您足不出户纵览文学世界',
'停课不停学,学好大语文,做有修养的中国人',
'扫描右方二维码会看到最适合您孩子的1~4个班级'
];
if ($action == self::ORGAN_CODE_STYLE_6) {
$text = [
"義学书院".$name,
'诚挚为您推荐诸葛学堂会员大礼包',
'愿你畅游文化世界',
'扫描右方二维码即可购买'
];
$newUrl = 'https://m.zhugexuetang.com/zgxt_vip?source=124';
}
} elseif ($organ == self::ORGAN_FLAG_DIERKETANG) {
$fileCata = "other";
$text = [
'第二课堂'.$name,
'愿您足不出户纵览文学世界',
'停课不停学,学好大语文,做有修养的中国人',
'扫描右方二维码会看到最适合您孩子的1~4个班级'
];
if ($action == self::ORGAN_CODE_STYLE_6) {
$text = [
"第二课堂".$name,
'诚挚为您推荐诸葛学堂会员大礼包',
'愿你畅游文化世界',
'扫描右方二维码即可购买'
];
$newUrl = 'https://m.zhugexuetang.com/zgxt_vip?source=125';
}
} elseif ($organ == self::ORGAN_FLAG_JIUFANG) {
$fileCata = "other";
$text = [
'九方书院'.$name,
'愿您足不出户纵览文学世界',
'停课不停学,学好大语文,做有修养的中国人',
'扫描右方二维码会看到最适合您孩子的1~4个班级'
];
if ($action == self::ORGAN_CODE_STYLE_6) {
$text = [
"九方书院".$name,
'诚挚为您推荐诸葛学堂会员大礼包',
'愿你畅游文化世界',
'扫描右方二维码即可购买'
];
$newUrl = 'https://m.zhugexuetang.com/zgxt_vip?source=126';
}
} elseif ($organ == self::ORGAN_FLAG_RULIN) {
$fileCata = "other";
$text = [
'儒林学院'.$name,
'愿您足不出户纵览文学世界',
'停课不停学,学好大语文,做有修养的中国人',
'扫描右方二维码会看到最适合您孩子的1~4个班级'
];
if ($action == self::ORGAN_CODE_STYLE_6) {
$text = [
"儒林学院".$name,
'诚挚为您推荐诸葛学堂会员大礼包',
'愿你畅游文化世界',
'扫描右方二维码即可购买'
];
$newUrl = 'https://m.zhugexuetang.com/zgxt_vip?source=127';
}
} elseif ($organ == self::ORGAN_FLAG_KANG) {
$fileCata = "other";
$text = [
'康爸爸'.$name,
'愿您足不出户纵览文学世界',
'停课不停学,学好大语文,做有修养的中国人',
'扫描右方二维码会看到最适合您孩子的1~4个班级'
];
if ($action == self::ORGAN_CODE_STYLE_6) {
$text = [
"康爸爸".$name,
'诚挚为您推荐诸葛学堂会员大礼包',
'愿你畅游文化世界',
'扫描右方二维码即可购买'
];
$newUrl = 'https://m.zhugexuetang.com/zgxt_vip?source=128';
}
} elseif ($organ == self::ORGAN_FLAG_DOUSHENSHUANGSHI) {
$fileCata = "doushenshuangshi";
$text = [
'豆神双师'.$name,
'诚挚为您推荐豆神大语文',
'扫描右方二维码',
'会看到最适合您孩子的1~4个班级',
];
if ($action == self::ORGAN_CODE_STYLE_3 || $action == self::ORGAN_CODE_STYLE_4 || $action == self::ORGAN_CODE_STYLE_5) {
return ['check' => false,'data' => '豆神双师只有大语文拔尖班,培优班海报哦!'];
}
} elseif ($organ == self::ORGAN_FLAG_KANGWEIXUETANG){
$fileCata = "other";
$text = [
'康微学堂'.$name,
'愿您足不出户纵览文学世界',
'停课不停学,学好大语文,做有修养的中国人',
'扫描右方二维码会看到最适合您孩子的1~4个班级'
];
if ($action == self::ORGAN_CODE_STYLE_6) {
$text = [
"康微学堂".$name,
'诚挚为您推荐诸葛学堂会员大礼包',
'愿你畅游文化世界',
'扫描右方二维码即可购买'
];
$newUrl = 'https://m.zhugexuetang.com/zgxt_vip?source=129';
}
} elseif ($organ == self::ORGAN_FLAG_HOUDEIJY){
$fileCata = "other";
$text = [
'兰德文化教育'.$name,
'愿您足不出户纵览文学世界',
'停课不停学,学好大语文,做有修养的中国人',
'扫描右方二维码会看到最适合您孩子的1~4个班级'
];
if ($action == self::ORGAN_CODE_STYLE_6) {
$text = [
"兰德文化教育".$name,
'诚挚为您推荐诸葛学堂会员大礼包',
'愿你畅游文化世界',
'扫描右方二维码即可购买'
];
$newUrl = 'https://m.zhugexuetang.com/zgxt_vip?source=130';
}
} elseif ($organ == self::ORGAN_FLAG_SUIXINKT){
$fileCata = "other";
$text = [
'随心课堂'.$name,
'愿您足不出户纵览文学世界',
'停课不停学,学好大语文,做有修养的中国人',
'扫描右方二维码会看到最适合您孩子的1~4个班级'
];
if ($action == self::ORGAN_CODE_STYLE_6) {
$text = [
"随心课堂".$name,
'诚挚为您推荐诸葛学堂会员大礼包',
'愿你畅游文化世界',
'扫描右方二维码即可购买'
];
$newUrl = 'https://m.zhugexuetang.com/zgxt_vip?source=131';
}
} elseif ($organ == self::ORGAN_FLAG_LISICHENLIUXUE){
$fileCata = "lsc_other";
$text = [
'立思辰留学'.$name,
'诚挚为您推荐豆神大语文,',
'扫描右方二维码',
'会看到最适合您孩子的1~4个班级'
];
} elseif ($organ == self::ORGAN_FLAG_LISICHENMEITEJY){
$fileCata = "minte";
$text = [
'敏特教育'.$name.'老师',
'诚挚为您推荐豆神大语文,',
'扫描右方二维码',
'会看到最适合您孩子的1~4个班级'
];
} elseif ($organ == self::ORGAN_FLAG_LISICHENRTW_YXH){
$fileCata = "lsc_other";
$text = [
'优学汇'.$name.'老师',
'诚挚为您推荐豆神大语文,',
'扫描右方二维码',
'会看到最适合您孩子的1~4个班级'
];
} elseif ($organ == self::ORGAN_FLAG_LISICHENRTW_XEZ){
$fileCata = "lsc_other";
$text = [
'学而知'.$name.'老师',
'诚挚为您推荐豆神大语文,',
'扫描右方二维码',
'会看到最适合您孩子的1~4个班级'
];
} elseif ($organ == self::ORGAN_FLAG_LISICHENRTW_TXH){
$fileCata = "lsc_other";
$text = [
'童学汇'.$name.'老师',
'诚挚为您推荐豆神大语文,',
'扫描右方二维码',
'会看到最适合您孩子的1~4个班级'
];
} elseif ($organ == self::ORGAN_FLAG_LISICHENRTW_WLWYJY){
$fileCata = "lianzhong";
$text = [
'联众教育培训学校'.$name.'老师',
'诚挚为您推荐豆神大语文,',
'扫描右方二维码',
'会看到最适合您孩子的1~4个班级'
];
if ($second) {
$text = [
'联众教育-'.$second_name,
'诚挚为您推荐豆神大语文,',
'扫描右方二维码',
'会看到最适合您孩子的1~4个班级'
];
}
} elseif ($organ == self::ORGAN_FLAG_LISICHENRTW_XJBNYC){
$fileCata = "xj_bainianyingcai";
$text = [
'新疆百年英才'.$name.'老师',
'诚挚为您推荐豆神大语文,',
'扫描右方二维码',
'会看到最适合您孩子的1~4个班级'
];
} elseif ($organ == self::ORGAN_FLAG_LISICHENQUYUFZ){
$fileCata = "lsc_other";
$text = [
'立思辰区域'.$name.'老师',
'诚挚为您推荐豆神大语文,',
'扫描右方二维码',
'会看到最适合您孩子的1~4个班级'
];
if ($second) {
$text = [
$second_name,
'诚挚为您推荐豆神大语文,',
'扫描右方二维码',
'会看到最适合您孩子的1~4个班级'
];
}
} elseif ($organ == self::ORGAN_FLAG_LISICHENJITUANZB){
$fileCata = "lsc_other";
$text = [
'立思辰集团'.$name.'老师',
'诚挚为您推荐豆神大语文,',
'扫描右方二维码',
'会看到最适合您孩子的1~4个班级'
];
if ($second) {
$text = [
$second_name,
'诚挚为您推荐豆神大语文,',
'扫描右方二维码',
'会看到最适合您孩子的1~4个班级'
];
}
} elseif ($organ == self::ORGAN_FLAG_LISICHENBAINIANYC){
$fileCata = "lsc_bainianyingcai";
$text = [
'百年英才'.$name.'老师',
'诚挚为您推荐豆神大语文,',
'扫描右方二维码',
'会看到最适合您孩子的1~4个班级'
];
if ($second) {
$text = [
$second_name,
'诚挚为您推荐豆神大语文,',
'扫描右方二维码',
'会看到最适合您孩子的1~4个班级'
];
}
} elseif ($organ == self::ORGAN_FLAG_LISICHENZONGBUKANGB){
$fileCata = "lsc_other";
$text = [
'康邦科技'.$name.'老师',
'诚挚为您推荐豆神大语文,',
'扫描右方二维码',
'会看到最适合您孩子的1~4个班级'
];
if ($second) {
$text = [
$second_name,
'诚挚为您推荐豆神大语文,',
'扫描右方二维码',
'会看到最适合您孩子的1~4个班级'
];
}
} elseif ($organ == self::ORGAN_FLAG_LISICHENZONGBUNX){
$fileCata = "lsc_other";
$text = [
'我是窦昕老师',
'很荣幸为您推荐,',
'扫描右方二维码',
'会看到最适合您孩子的1~4个班级'
];
} elseif($organ == self::ORGAN_FLAG_LISICHENKUAXUEWANG){
$fileCata = "lsc_other";
$text = [
'跨学网'.$name.'老师',
'诚挚为您推荐豆神大语文,',
'扫描右方二维码',
'会看到最适合您孩子的1~4个班级'
];
if ($second) {
$text = [
$second_name,
'诚挚为您推荐豆神大语文,',
'扫描右方二维码',
'会看到最适合您孩子的1~4个班级'
];
}
}elseif($organ == self::ORGAN_FLAG_LISICHENJTSHICHANGBU){
$fileCata = "lsc_other";
$text = [
$name.'老师',
'诚挚为您推荐豆神大语文,',
'扫描右方二维码',
'会看到最适合您孩子的1~4个班级'
];
if ($second) {
$text = [
$second_name,
'诚挚为您推荐豆神大语文,',
'扫描右方二维码',
'会看到最适合您孩子的1~4个班级'
];
}
}elseif($organ == self::ORGAN_FLAG_YIQI){
$fileCata = "other";
$text = [
'易启'.$name,
'愿您足不出户纵览文学世界',
'停课不停学,学好大语文,做有修养的中国人',
'扫描右方二维码会看到最适合您孩子的1~4个班级'
];
if ($action == self::ORGAN_CODE_STYLE_6) {
$text = [
"易启".$name,
'诚挚为您推荐诸葛学堂会员大礼包',
'愿你畅游文化世界',
'扫描右方二维码即可购买'
];
$newUrl = 'https://m.zhugexuetang.com/zgxt_vip?source=133';
}
}elseif($organ == self::ORGAN_FLAG_ZHONGQIAOGUOLV){
$fileCata = "zhongqiaoguolv";
$text = [
'中侨国旅'.$name,
'愿您足不出户纵览文学世界',
'停课不停学,学好大语文,做有修养的中国人',
'扫描右方二维码会看到最适合您孩子的1~4个班级'
];
if ($action == self::ORGAN_CODE_STYLE_6) {
$text = [
"中侨国旅".$name,
'诚挚为您推荐诸葛学堂会员大礼包',
'愿你畅游文化世界',
'扫描右方二维码即可购买'
];
$newUrl = 'https://m.zhugexuetang.com/zgxt_vip?source=134';
}
}elseif($organ == self::ORGAN_FLAG_LISICHENHUIRONGEXUE){
$fileCata = "huirongexue";
$text = [
$name,
'诚挚为您推荐豆神大语文,',
'扫描右方二维码',
'会看到最适合您孩子的1~4个班级'
];
}elseif($organ == self::ORGAN_FLAG_GAINIANXING){
$fileCata = "gainianxing";
$text = [
$name,
'愿您足不出户纵览文学世界',
'停课不停学,学好大语文,做有修养的中国人',
'扫描右方二维码会看到最适合您孩子的1~4个班级'
];
if ($action == self::ORGAN_CODE_STYLE_6) {
$text = [
"我是".$name,
'很荣幸为您推荐诸葛学堂会员大礼包',
'愿你畅游文化世界',
'扫描右方二维码即可购买'
];
$newUrl = 'https://m.zhugexuetang.com/zgxt_vip?source=137';
}
} elseif($organ == self::ORGAN_FLAG_LAOJIN) {
$fileCata = "other";
$text = [
$name,
'愿您足不出户纵览文学世界',
'停课不停学,学好大语文,做有修养的中国人',
'扫描右方二维码会看到最适合您孩子的1~4个班级'
];
if ($action == self::ORGAN_CODE_STYLE_6) {
$text = [
$name,
'诚挚为您推荐诸葛学堂会员大礼包',
'愿你畅游文化世界',
'扫描右方二维码即可购买'
];
$newUrl = 'https://m.zhugexuetang.com/zgxt_vip?source=138';
}
} elseif($organ == self::ORGAN_FLAG_CAICAI) {
$fileCata = "other";
$text = [
$name,
'愿您足不出户纵览文学世界',
'停课不停学,学好大语文,做有修养的中国人',
'扫描右方二维码会看到最适合您孩子的1~4个班级'
];
if ($action == self::ORGAN_CODE_STYLE_6) {
$text = [
$name,
'诚挚为您推荐诸葛学堂会员大礼包',
'愿你畅游文化世界',
'扫描右方二维码即可购买'
];
$newUrl = 'https://m.zhugexuetang.com/zgxt_vip?source=139';
}
}elseif($organ == self::ORGAN_FLAG_ZJXT) {
$fileCata = "other";
$text = [
'',
'',
'',
''
];
$newUrl = 'https://m.zhugexuetang.com/zhugexuetang/course?type=10004';
}
$code = self::get_qr_tel($tel);
$organ_code = $organ.'_0_0_'.$code;
if ($second) {
$organ_code = $organ_code.':'.self::$second_id;
}
$url = "https://bm.zhugexuetang.com?fromEntrance=1&entrance=2&staff_code=".$organ_code;
if (in_array($organ,array_diff(self::ORGAN_ARRAY,self::ORGAN_NO_DEPARTMENT_INITIAL_ARRAY))) {
if ($action == self::ORGAN_CODE_STYLE_1) {
$code_xy = '590,2930';
$text1_xy = '20,2940';
$text2_xy = '20,2975';
$text3_xy = '20,3010';
$text4_xy = '20,3045';
$color = '0,0,88';
$imagePath = '/library/'.$fileCata.'/1.png';
} elseif ($action == self::ORGAN_CODE_STYLE_2) {
$code_xy = '590,3160';
$text1_xy = '20,3170';
$text2_xy = '20,3205';
$text3_xy = '20,3240';
$text4_xy = '20,3275';
$color = '0,0,0';
$imagePath = '/library/'.$fileCata.'/2.png';
} elseif ($action == self::ORGAN_CODE_STYLE_3) {
$code_xy = '590,2740';
$text1_xy = '20,2750';
$text2_xy = '20,2785';
$text3_xy = '20,2820';
$text4_xy = '20,2855';
$color = '0,0,0';
$imagePath = '/library/'.$fileCata.'/3.png';
} elseif ($action == self::ORGAN_CODE_STYLE_4) {
$code_xy = '590,2740';
$text1_xy = '20,2750';
$text2_xy = '20,2785';
$text3_xy = '20,2820';
$text4_xy = '20,2855';
$color = '0,0,0';
$imagePath = '/library/'.$fileCata.'/4.png';
} elseif ($action == self::ORGAN_CODE_STYLE_5) {
$code_xy = '590,3220';
$text1_xy = '20,3230';
$text2_xy = '20,3265';
$text3_xy = '20,3305';
$text4_xy = '20,3345';
$color = '0,0,0';
$imagePath = '/library/'.$fileCata.'/5.png';
} elseif ($action == self::ORGAN_CODE_STYLE_6) {
$code_xy = '850,3950';
$text1_xy = '50,4010';
$text2_xy = '50,4045';
$text3_xy = '50,4080';
$text4_xy = '50,4115';
$color = '0,0,179';
$imagePath = '/library/'.$fileCata.'/6.png';
} elseif ($action == self::ORGAN_CODE_STYLE_8) {
$code_xy = '850,6150';
$text1_xy = '50,6210';
$text2_xy = '50,6245';
$text3_xy = '50,6280';
$text4_xy = '50,6315';
$color = '0,0,88';
$imagePath = '/library/'.$fileCata.'/8.png';
} elseif ($action == self::ORGAN_CODE_STYLE_9) {
$code_xy = '850,3950';
$text1_xy = '50,4010';
$text2_xy = '50,4045';
$text3_xy = '50,4080';
$text4_xy = '50,4115';
$color = '0,0,88';
$imagePath = '/library/'.$fileCata.'/9.png';
}else {
return ['check' => false,'data' => '生成二维码底图参数错误'];
}
} elseif (in_array($organ,self::ORGAN_NO_DEPARTMENT_INITIAL_ARRAY)) {
if ($organ == self::ORGAN_FLAG_ZJXT) {
$code_xy = '535,1350';
$text1_xy = '50,4010';
$text2_xy = '50,4045';
$text3_xy = '50,4080';
$text4_xy = '50,4115';
$color = '0,0,88';
$imagePath = '/library/'.$fileCata.'/7.png';
$url = $newUrl.'&staff_code='.$organ_code;
} else {
if ($action == self::ORGAN_CODE_STYLE_1) {
$code_xy = '586,2930';
$text1_xy = '20,2950';
$text2_xy = '20,2985';
$text3_xy = '20,3020';
$text4_xy = '20,3055';
$color = '0,0,88';
$imagePath = '/library/'.$fileCata.'/1.png';
} elseif ($action == self::ORGAN_CODE_STYLE_2) {
$code_xy = '586,3150';
$text1_xy = '20,3170';
$text2_xy = '20,3205';
$text3_xy = '20,3240';
$text4_xy = '20,3275';
$color = '0,0,0';
if ($organ == self::ORGAN_FLAG_DOUSHENSHUANGSHI) {
$color = '0,0,88';
}
$imagePath = '/library/'.$fileCata.'/2.png';
}elseif ($action == self::ORGAN_CODE_STYLE_3) {
$code_xy = '586,2730';
$text1_xy = '20,2750';
$text2_xy = '20,2785';
$text3_xy = '20,2820';
$text4_xy = '20,2855';
$color = '0,0,0';
$imagePath = '/library/'.$fileCata.'/3.png';
}elseif ($action == self::ORGAN_CODE_STYLE_4) {
$code_xy = '586,2730';
$text1_xy = '20,2750';
$text2_xy = '20,2785';
$text3_xy = '20,2820';
$text4_xy = '20,2855';
$color = '0,0,0';
$imagePath = '/library/'.$fileCata.'/4.png';
}elseif ($action == self::ORGAN_CODE_STYLE_5) {
$code_xy = '586,3230';
$text1_xy = '20,3250';
$text2_xy = '20,3285';
$text3_xy = '20,3320';
$text4_xy = '20,3355';
$color = '0,0,0';
$imagePath = '/library/'.$fileCata.'/5.png';
}elseif ($action == self::ORGAN_CODE_STYLE_6) {
$code_xy = '590,2935';
$text1_xy = '25,2955';
$text2_xy = '25,2990';
$text3_xy = '25,3025';
$text4_xy = '25,3060';
$color = '0,0,0';
$imagePath = '/library/'.$fileCata.'/6.png';
$url = $newUrl.'&staff_code='.$organ_code;
}else {
return ['check' => false,'data' => '生成二维码底图参数错误'];
}
}
}
$textCoordinates = [$text1_xy,$text2_xy,$text3_xy,$text4_xy];
$size = 18;$code_level = 2;
if (in_array($action,[self::ORGAN_CODE_STYLE_6,self::ORGAN_CODE_STYLE_8,self::ORGAN_CODE_STYLE_9])&&
in_array($organ,array_diff(self::ORGAN_ARRAY,self::ORGAN_NO_DEPARTMENT_INITIAL_ARRAY))) {
$size = 20;
$code_level = 3;
} elseif ($action == self::ORGAN_CODE_STYLE_10) {
$size = 20;
$code_level = 2.2;
}
$return = self::CreatCard($url,$imagePath,$code_xy,$text,$textCoordinates,$color,$size,$code_level);
if ($return['check'] == false) {
return false;
}
if ($second) {
$staff_info = ShopStaffInfo::find()->select('id')
->where(['is_deleted'=>self::STAFF_STATUS,'id'=>self::$second_id])->asArray()->one();
} else {
$staff_info = ShopStaffInfo::find()->select('id')
->where(['is_deleted'=>self::STAFF_STATUS,'tel'=>trim($tel),'staff_source'=>$organ])->asArray()->one();
}
self::updateInfoData(['code'=>$organ_code],['id'=>$staff_info['id']]);
return ['check' => true,'data' => $return['data']];
}
public static function CreatCard ($url,$backgroundImage,string $qr_code_coordinates,array $text = [],array $coordinates = [],$colour,$size,$code_level)
{
if (!$url || !$qr_code_coordinates) {
return ['check' => false,'data' => '二维码跳转链接或者二维码坐标不能为空'];
}
if (count($text) != count($coordinates)) {
return ['check' => false,'data' => '水印文字的数量与提供的坐标不符'];
}
$path = '/tmp/recruitcard';
if (!is_dir($path)) {
@mkdir($path);
}
include(ROOT_PATH . '/library/phpqrcode/qrlib.php');
$qrcodePath = $path . '/' . date('Y-m-d').'-'.rand(10000,99999) . '.png';
\QRcode::png($url, $qrcodePath, 3,$code_level);
$dst = (ROOT_PATH . $backgroundImage);
$dst_im1 = imagecreatefrompng($dst);
$dst_info1 = getimagesize($dst);
$src1 = $qrcodePath;
$src1_im = imagecreatefrompng($src1);
$src1_info = getimagesize($src1);
$code_xy = explode(',',$qr_code_coordinates);
imagecopymerge($dst_im1,$src1_im,$code_xy[0],$code_xy[1],0,0,$src1_info[0],$src1_info[1],100);
$path = '/tmp/gentlemancard';
if (!is_dir($path)) {
@mkdir($path);
}
$poster_marge_path =$path . '/' . date('Y-m-d').'-'.rand(0,9999) . '.png';
ob_start();
imagepng($dst_im1,$poster_marge_path);
imagedestroy($dst_im1);
imagedestroy($src1_im);
$dst_path = $poster_marge_path;
$dst_new = imagecreatefromstring(file_get_contents($dst_path));
$font = (ROOT_PATH . '/library/gentlemanImg/fzlthk.ttf');
$im = imagecreatetruecolor(400, 30);
$colour = explode(',',$colour);
$colour =imagecolorallocate($im, $colour[0],$colour[1],$colour[2]);
foreach ($text as $key=>$value) {
$text_xy = explode(',',$coordinates[$key]);
imagefttext($dst_new, $size, 0,$text_xy[0], $text_xy[1], $colour, $font, $value);
}
header('Content-type: image/png');
imagepng($dst_new);
@unlink($dst_new);
$sImage = ob_get_contents();
ob_end_clean();
$base64_img = base64_encode($sImage);
@unlink($qrcodePath);
return ['check' => true,'data' => $base64_img];
}
public static function get_qr_tel($tel)
{
$tel = str_replace("0", "R", $tel);
$tel = str_replace("1", "I", $tel);
$tel = str_replace("2", "Z", $tel);
$tel = str_replace("3", "B", $tel);
$tel = str_replace("4", "H", $tel);
$tel = str_replace("5", "G", $tel);
$tel = str_replace("6", "E", $tel);
$tel = str_replace("7", "C", $tel);
$tel = str_replace("8", "F", $tel);
$tel = str_replace("9", "O", $tel);
$tel = substr_replace($tel, 'AKMN', 11, 0);
return $tel;
}
public static function updateInfoData($data,$where) {
ShopStaffInfo::getDb()->createCommand()->
update(ShopStaffInfo::tableName(), $data, $where )
->execute();
}
public static function getOrganDepartmentInfo($organ)
{
$OrganInfo = array(
"department" => 1,
"department_list" => array(),
"secondChannel" => 0,
);
if(in_array($organ,self::ORGAN_NO_DEPARTMENT_INITIAL_ARRAY)){
}elseif(in_array($organ,self::ORGAN_NO_DEPARTMENT_LATER_ARRAY)){
$OrganInfo["department"] = 2;
$OrganInfo["department_list"] = array();
}elseif(in_array($organ,self::ORGAN_DEPARTMENT_LATER_ARRAY)){
$OrganInfo["department"] = 3;
$OrganInfo["department_list"] = self::ORGAN_DEPARTMENT_INFO[$organ];
}
if(in_array($organ,self::ORGAN_CHANNEL_ARRAY)){
$OrganInfo["secondChannel"] = 1;
}else{
$OrganInfo["secondChannel"] = 2;
}
return $OrganInfo;
}
}