function RegisterAssist(udid)--------------
	--local path = "http://604560.ichengyun.net"
	
	Log('平台辅助验证')
	local path = "http://api.wj.ink"
	local updata = "/uploadAssist.action"
	local wancheng = "/finishAssist.action"
	local userName = selects.注册辅助平台账号 
	local userPwd = selects.注册辅助平台密码
	local grade = selects.辅助方等级限制
	if assistU then
		QRcode = {--------------------------上传或下载二维码-----------QRcode.dmImg()-----下载二维码---------------QRcode.upImg()----- 上传二维码
			upImg = (function()	--上传二维码
				--local str = screen.image(46,  erwma,446,  erwma+350):qr_decode()
				local str = screen.image():qr_decode()
				if str then
					Log('上传二维码')
					return str
				else
					Log('解析失败')
					touch.on(440,880):msleep(10):step_len(20):move(440,480):off()
					sys.sleep(1)
					return false
					--return 3	--解析失败
				end
			end),
			dmImg = (function()	--获取二维码
			Files_Path = {	
			NZT_Path = "/var/mobile/iGrimace",	--NZT文件路径
			HD_Path = "/User/hdFaker/bak",
			--Contacts_Path = '/var/mobile/Media/1ferver/无极文档/微信文档/通讯录/',	--通讯录生成路径
			Contacts_Path = '/var/mobile/Media/1ferver/lua/scripts/文档/微信通讯录/',	--通讯录生成路径
			Text = '/var/mobile/Media/1ferver/lua/scripts/文档/',
			--Text1 = '/var/mobile/Media/1ferver/无极文档/微信文档/',	--发信息调用文本
			Module_Path = "/var/mobile/Media/1ferver/lua/General/",	--加载模块路径
			Log_Path = '/var/mobile/Media/1ferver/lua/scripts/日志.txt',	--日志生成路径
			plfilename = "/var/mobile/Library/Preferences/org.ioshack.igrimace.plist", --设置plist路径
			daemon = "/var/mobile/Media/1ferver/bin/",	--加载daemon模块路径
			HTTP_MD5 = "http://www.wuji-vip.com:8082/getFileMd5.action?fileName=",	--获取服务器文件MD5
			HTTP_MD51 = 'http://file.wuji-vip.com/getFileMd5.action?fileName=',	 --获取服务器文件MD5
			HTTP_Address = "http://www.wuji-vip.com:8082/downLoad.action?uri=",	--服务器下载路径
			HTTP_Address1 = 'http://file.wuji-vip.com/downLoad.action?uri=',	 --服务器下载路径	
			Image_Path = '/var/mobile/Media/1ferver/无极文档/微信文档/群发图片/',	--发送图片调用路径
			}
			local m_package_path = package.path
			package.path = string.format("%s?.xxt;%s?/init.xxt;%s", Files_Path.Module_Path, Files_Path.Module_Path, m_package_path)
			--]]
			local wch = require("wch")
			local s,_,r = http.post('http://api.wj.ink/uriUpAt.action',5,{})
			if s == 200 then
			r = json.decode(r)
			if r.code == 0 then
			wch.scanQRCodeLogin(r.url)
			return 0
			else
			return 1
			end
			else
			return 2
			end
			end),
			dlImg = (function(url)	--删除二维码
			url = 'url='..url
			local s,_,r = http.post('http://api.wj.ink/oi/deleteGroupLink.action',5,{},url)
			if s == 200 then
			nLog(r)
			r = json.decode(r)
			if r.code == 0 then
				Log('删除成功')
			return 0	--删除成功
			else
			Log('删除失败')
			return 1	--删除失败
			end
			else
			Log('连接失败')
			return 2	--连接失败
			end
			end),
		}
			url = QRcode.upImg()----- 上传二维码
			if selects.国家选项 == '国内号' then
				Type = '1'
			elseif selects.国家选项 == '国外号' then
				Type = '2'
			end
		getnum = '手机号'
		if WeChatRegister_Table.注册脚本配置.辅助类型 == '手机号码上传辅助'  then 
			url = getnum
			Log(url)
			if WeChatRegister_Table.注册脚本配置.国家号码选项 == '国内号' then
				url = getnum
				Type = '3'
			else
				url = Regionxg..getnum
				Type = '4'
			end	
		end--]]
		phone = Type
		--------
		----------------------------------------------------------------------
		local uri = url
		--local uuid = {}
		while uri do
			local str,str1,str2 = http.post(path..updata,5,{},"userName="..userName.."&userPwd="..userPwd.."&uri="..uri.."&phone="..phone.."&grade="..grade.."&type="..Type)
			Log(path..updata.."userName="..userName.."&userPwd="..userPwd.."&uri="..uri.."&phone="..phone.."&grade="..grade.."&type="..Type)
			Log(str)
			if str == 200 then
				Log('finishAssist'..str2)
				if json.decode(str2).code == "0100" then
					sys.toast("失败，参数不正确")
					Log("失败，参数不正确")
				elseif json.decode(str2).code == "0101" then
					sys.toast("失败，账号不存在")
					Log("失败，账号不存在")
				elseif json.decode(str2).code == "0102" then
					sys.toast("失败，密码不正确")
					Log("失败，密码不正确")
				elseif json.decode(str2).code == "0103" then
					sys.toast("失败，账户异常")
					Log("失败，账户异常")
				elseif json.decode(str2).code == "0250" then
					sys.toast("您的余额不足了!"..json.decode(str2).code)
					Log("您的余额不足了!"..json.decode(str2).code)
				elseif json.decode(str2).code == "0300" then
					sys.toast("设置任务的金额为零，上传失败!")
					Log("设置任务的金额为零，上传失败!")	
				elseif json.decode(str2).code == "0003" then
					Log("上传成功")
					assistU = false
					Register_Assist = true
					Log(json.decode(str2).assistUuid)
					assistUuid = json.decode(str2).assistUuid
					return Register_Assist,assistUuid
				elseif json.decode(str2).code == "0301" then
					Log("上传重复")
					assistU = false
					Register_Assist = true
					return Register_Assist,assistUuid
				else
					assistU = false
					sys.toast("什么鬼"..json.decode(str2).code)
					Log("什么鬼"..json.decode(str2).code)
				end
			else
				sys.toast("网络异常,请检查本机网络状态正常,或联系客服人员!!!")
			end
			sys.msleep(1000)
		end
	else
		--for i,v in ipairs(uuid) do
			--nLog(v)
			while 1 do
				local st,st1,st2 = http.post(path..wancheng,5,{},"userName="..userName.."&userPwd="..userPwd.."&assistUuid="..udid)
				Log("&assistUuid="..udid)
				if st == 200 then
					if st2 == "0100" then
						sys.toast("失败，参数不正确")
					elseif st2 == "0101" then
						sys.toast("失败，账号不存在")
					elseif st2 == "0102" then
						sys.toast("失败，密码不正确")
					elseif st2 == "0103" then
						sys.toast("失败，账户异常")
					elseif st2 == "0202" then
						sys.toast("找不到该任务")
						break
					elseif st2 == "0201" then
						sys.toast("失败，该任务不是该用户的任务")
					elseif st2 == "0222" then
						sys.toast("该任务没有领取者，完成不了")
					elseif st2 == "0208" then
						sys.toast("失败，该任务已经完成")
						break
					elseif st2 == "0003" then
						sys.toast("成功")
						Log("成功")
						break
					end
				end
			end
		--end
	end		
end
	--[[	function Log(str)	--日志
			local linecount = file.line_count('/var/mobile/Media/1ferver/lua/scripts/日志.txt')
			if linecount ~= nil then
				if tonumber(linecount) >= 10000 then
					local success, line = file.remove_line('/var/mobile/Media/1ferver/lua/scripts/日志.txt', 1)
				end
			end
			nLog(str)
			local tn = os.date("%Y/%m/%d %H:%M:%S")
			local t = '【'..tn..'】\t'..str..'\r\n'
			local success = file.appends('/var/mobile/Media/1ferver/lua/scripts/日志.txt', t)
		end
		function _Color(XX,sim,x,y,x1,y1)	--找色并点击
			local sim  = sim or 75
			for i,v in ipairs(XX) do
				local x,y=screen.find_color(v,sim,x,y,x1,y1)
				if x ~= -1 and y ~= -1 then
					ClickOn(x,y)
					Log('色'..i)
					return true
				end	
			end	
			return false
		end
		function Sleep(time_Mini,time_Max)	--随机延时
			sys.msleep(math.random(time_Mini,time_Max))
		end

		function ClickOn(x,y)	--偏移点击
			--touch.tap(math.random(x-3,x+3),math.random(y-3,y+3))
			touch.on(math.random(x-3,x+3),math.random(y-3,y+3)):msleep(math.random(5,50)):off()
			Sleep(300,800)
		end

		function Color_(XX,sim,x,y,x1,y1)	--找色不点击
			local sim  = sim or 75
			for i,v in ipairs(XX) do
				local x,y=screen.find_color(v,sim,x,y,x1,y1)
				if x ~= -1 and y ~= -1 then
					--ClickOn(x,y)
					Log('色'..i)
					return x,y
				end	
			end	
			return false
		end

		dlg = dialog() -- 创建一个 dialog 对象
		:add_switch('返回上一页',false)
		:config('脚本配置')
		:size(640,1136)
		:timeout(10)
		:add_label('------------平台连接：http://api.wj.ink------------------------------')
		:add_picker('国家选项',{'国内号','国外号'},'国内号')
		:add_input('注册辅助平台账号','必填') 
		:add_input('注册辅助平台密码','必填') 
		:add_range('辅助方等级限制',{1,6,1},1)
		confirm, selects = dlg:show() -- 显示 dialog 对象到前台并获得其返回值--]]
		
	--[[二维码页面 = {-----二维码页面 
			{{  100,  549, 0x000000},{  111,  552, 0xffffff},{  121,  551, 0x000000},{  142,  552, 0xffffff},{  101,  803, 0x000000},{  109,  802, 0xffffff},{  120,  799, 0x000000},{  143,  801, 0xffffff},{  151,  801, 0x010101},},
			{{  101,  504, 0x000000},{  109,  502, 0xffffff},{  124,  504, 0x000000},{  141,  504, 0xffffff},{  151,  503, 0x000000},{  101,  755, 0x000000},{  107,  753, 0xffffff},{  123,  756, 0x000000},{  143,  757, 0xffffff},{  151,  757, 0x000000},},
			{{  101,  509, 0x000000},{  109,  509, 0xfffffe},{  119,  508, 0x000000},{  143,  505, 0xfffffe},{  152,  505, 0x000000},{  100,  753, 0x000000},{  109,  751, 0xfffffe},{  125,  757, 0x000000},{  142,  756, 0xfffffe},{  151,  756, 0x010100},},
			{{   58,  731, 0x000000},{   69,  731, 0xffffff},{   81,  731, 0x000000},{  100,  731, 0xffffff},{  109,  736, 0x000000},{   58,  986, 0x000000},{   68,  986, 0xffffff},{   79,  985, 0x000000},{  100,  987, 0xffffff},{  110,  986, 0x000000},},
			{{   60,  731, 0x000000},{   68,  731, 0xffffff},{   80,  731, 0x000000},{  101,  741, 0xffffff},{  109,  739, 0x000000},{   57,  986, 0x000000},{   69,  985, 0xffffff},{   77,  985, 0x000000},{   99,  987, 0xffffff},{  108,  987, 0x000000},},
			{{  131,  641, 0x000000},{  140,  639, 0xffffff},{  151,  644, 0x000000},{  172,  642, 0xffffff},{  182,  643, 0x000000},{  131,  893, 0x000000},{  141,  893, 0xffffff},{  150,  893, 0x000000},{  171,  893, 0xffffff},},
			{{   59,  738, 0x000000},{   65,  736, 0xffffff},{   79,  734, 0x000000},{  100,  730, 0xffffff},{  108,  727, 0x000000},{   59,  986, 0x000000},{   67,  984, 0xffffff},{   80,  986, 0x000000},{  101,  987, 0xffffff},{  108,  986, 0x000000},},
			{{  130,  585, 0x000000},{  137,  587, 0xfffffe},{  147,  587, 0x010100},{  170,  588, 0xfffffe},{  181,  588, 0x010100},{  130,  841, 0x000000},{  140,  842, 0xfffffe},{  150,  841, 0x000000},{  172,  836, 0xfffffe},},
			{{   59,  686, 0x000000},{   66,  684, 0xffffff},{   77,  687, 0x000000},{  100,  694, 0xffffff},{  109,  696, 0x000000},{   58,  949, 0x000000},{   66,  947, 0xffffff},{   81,  941, 0x000000},{  101,  938, 0xffffff},{  107,  936, 0x000000},},
			{{   58,  679, 0x000000},{   66,  679, 0xffffff},{   84,  680, 0x000000},{   99,  680, 0xffffff},{  108,  676, 0x000000},{   59,  929, 0x000000},{   67,  930, 0xffffff},{   79,  929, 0x000000},{  101,  931, 0xffffff},{  108,  929, 0x000000},},
			{{   64,  220, 0xc5c5c8},{   54,  360, 0xc5c5c8},{  306,   98, 0xffffff},{  305,   93, 0x1a1a1f},{  306,   88, 0xffffff},{  305,   84, 0x1a1a1f},{  305,   80, 0xffffff},{  300,   76, 0x1a1a1f},{  299,   68, 0xffffff},{   54,  507, 0xc5c5c8},},
			{{  208,  931, 0x00b100},{  275,  935, 0x00b100},{  438,  943, 0x00b100},{  209,  609, 0x26272a},{  449,  606, 0x26272a},{   53,  269, 0xc8c8c9},{   41,  429, 0xc8c8c9},},
			{{  182,  921, 0x00b100},{  341,  946, 0x00b100},{   40,  752, 0xb0b0b1},{  128,  609, 0x252529},{  425,  604, 0x252529},{  270,  643, 0xffffff},{  304,   97, 0xffffff},{  306,   94, 0x252529},{  307,   87, 0xffffff},},
			{{   52,  387, 0xc5c5cb},{   53,  178, 0xc5c5cb},{  127,  524, 0x1aad19},{  253,  935, 0x00b000},{  561,  947, 0xb2b2b2},{  112,  856, 0xb0b0b0},},
			{{   41,  635, 0xcccccd},{   40,  218, 0xcccccd},{   64,  812, 0xecebeb},{  332,  817, 0xecebeb},{  314,  731, 0x010101},{  309,  733, 0xffffff},{  305,  733, 0x010101},{  301,  734, 0xffffff},{  299,  733, 0x010101},},
			{{   41,  220, 0xc6c6cc},{  308,  218, 0xc5c5cb},{   41,  635, 0xc6c6cc},{   49,  797, 0xebebeb},{  464,  799, 0xebebeb},{   49, 1083, 0xebebeb},{  308,  637, 0xc5c5cb},{  313,  733, 0x000000},{  308,  732, 0xffffff},},
	}
	注册返回 = {-----注册返回 
			{{  475,  729, 0x1aad19},{  174,  709, 0x1aad19},{  237,  741, 0x1aad19},{   77,  711, 0x1aad19},{  279,  288, 0x10aeff},{  321,  282, 0xffffff},{  321,  254, 0xffffff},{  385,  306, 0x10aeff},},
			{{  493,  623, 0x1aad19},{  329,  576, 0x1aad19},{  309,  633, 0x1aad19},{  155,  594, 0x1aad19},{  352,  339, 0x09bb07},{  311,  316, 0xffffff},{  310,  286, 0x09bb07},{  283,  299, 0xffffff},{  384,  300, 0x09bb07},},
			{{  481,  609, 0x1aad19},{  147,  602, 0x1aad19},{  329,  340, 0x09bb07},{  307,  321, 0xffffff},{  301,  277, 0x09bb07},{  278,  296, 0xffffff},{  359,  273, 0xffffff},{  391,  269, 0x09bb07},},
			{{  175,  609, 0x1aad19},{  302,  577, 0x1aad19},{  318,  632, 0x1aad19},{  503,  603, 0x1aad19},{  138,  589, 0x1aad19},{  343,  334, 0x09bb07},{  303,  319, 0xffffff},{  303,  301, 0x09bb07},},
			{{  315,  768, 0x1aad19},{  321,  710, 0x1aad19},{  474,  752, 0x1aad19},{  323,  363, 0x10aeff},{  267,  279, 0x10aeff},{  342,  228, 0x10aeff},{  374,  289, 0x10aeff},{  322,  294, 0xffffff},},
			{{  140,  590, 0x1aad19},{  273,  576, 0x1aad19},{  311,  629, 0x1aad19},{  485,  611, 0x1aad19},{  341,  343, 0x09bb07},{  305,  320, 0xffffff},{  365,  270, 0xffffff},{  272,  247, 0x09bb07},},
			{{  179,  712, 0x1aad18},{  313,  700, 0x1aad18},{  487,  766, 0x1aad18},{  246,  292, 0x10afff},{  319,  288, 0xffffff},{  322,  266, 0x10afff},{  322,  258, 0xffffff},{  322,  229, 0x10afff},{  384,  294, 0x10afff},},
			{{  109,  619, 0x1aad19},{  509,  627, 0x1aad19},{  349,  598, 0xffffff},{  345,  596, 0x1aad19},{  341,  597, 0xffffff},{  285,  340, 0x09bb07},{  309,  317, 0xffffff},{  362,  269, 0xffffff},{  351,  244, 0x09bb07},{  331,  329, 0x09bb07},},
		}--]]
	assistU = true
	while true do
		if Color_(二维码页面,98) then
			if Register_Assist then
				sys.toast('二维码已上传平台正在辅助处理中.....')
				Log('二维码已上传平台正在辅助处理中.....')
				Sleep(1000,1500)
				local path = "http://api.wj.ink"
				local userName = selects.注册辅助平台账号
				local userPwd = selects.注册辅助平台密码
					if (os.time()-time) >= 300 then
						while true do
							local code, res_headers, body = http.post(path.."/onFail.action",5,{},"userName="..userName.."&userPwd="..userPwd.."&script=8f6834b7cfed4438a79932662f776647&uid="..udidudid)
							if code == 200 then
								body = json.decode(body)
								Log('辅助失败')
								assistU = true
								break
							else	
								sys.toast("网络异常,请检查本机网络状态正常,或联系客服人员!!!")
							end
						end
					else
						sys.sleep(2)
								-----查询
						local code, res_headers, body = http.post(path.."/dataState.action",5,{},"userName="..userName.."&userPwd="..userPwd.."&script=8f6834b7cfed4438a79932662f776647&uid="..udidudid)
						if code == 200 then
							body = json.decode(body)
							if body == '参数错误,失败' then
								Log('参数错误,失败')
								sys.toast('参数错误,失败')
							elseif body == '不存在该识别码,失败' then
								Log('不存在该识别码,失败')
								sys.toast('不存在该识别码,失败')
							elseif body == '账号不存在,失败' then
								Log('账号不存在,失败')
								sys.toast('账号不存在,失败')
							elseif body == '密码不正确,失败' then
								Log('密码不正确,失败')
								sys.toast('密码不正确,失败')
							elseif body == '账户异常,失败' then
								Log('账户异常,失败')
								sys.toast('账户异常,失败')
							elseif body == '找不到该任务,失败' then
								Log('找不到该任务,失败')
								sys.toast('找不到该任务,失败')
							elseif body == '该任务不是该用户的任务' then
								Log('该任务不是该用户的任务')
								sys.toast('该任务不是该用户的任务')
							elseif body == '该任务正在等待领取,可能是你的任务佣金设置过低，提高佣金可加快任务领取' then
								Log('该任务正在等待领取,可能是你的任务佣金设置过低，提高佣金可加快任务领取')
								sys.toast('该任务正在等待领取,可能是你的任务佣金设置过低，提高佣金可加快任务领取')
							elseif body == '该任务正在等待领取，如无人领取请提高佣金金额' then
								Log('该任务正在等待领取，如无人领取请提高佣金金额')
								sys.toast('该任务正在等待领取，如无人领取请提高佣金金额')
							elseif body == '该任务正在执行中...' then
								Log('该任务正在执行中')
								sys.toast('该任务正在执行中')
							elseif body == '该任务执行方已完成,请确认' then
								Log('该任务执行方已完成')
								sys.toast('该任务执行方已完成')
							elseif body == '该任务已完成' then
								Log('该任务已完成')
								sys.toast('该任务已完成')
								time1122 = os.time()
								while true do
									if Color_(注册返回,98) then
										while true do
											local code, res_headers, body = http.post(path.."/onFinish.action",5,{},"userName="..userName.."&userPwd="..userPwd.."&script=8f6834b7cfed4438a79932662f776647&uid="..udidudid)
											if code == 200 then
												body = json.decode(body)
												Log('辅助成功')
											break
											else
												sys.toast("网络异常,请检查本机网络状态正常,或联系客服人员!!!")
											end
										break
										end
										if (os.time()-time) >= 300 then
											while true do
												local code, res_headers, body = http.post(path.."/onFail.action",5,{},"userName="..userName.."&userPwd="..userPwd.."&script=8f6834b7cfed4438a79932662f776647&uid="..udidudid)
												if code == 200 then
													body = json.decode(body)
													Log('辅助失败')
													break
												else
													sys.toast("网络异常,请检查本机网络状态正常,或联系客服人员!!!")
												end
											end
											break
										end
									end
								end	
							else
								sys.toast("网络异常,请检查本机网络状态正常,或联系客服人员!!!")
							end
								
						end
					end	
			else
				
				Register_Assist,udidudid = RegisterAssist()
				time = os.time()
			end
		elseif _Color(注册返回,98) then
			erwma = 497
			Log('验证返回')
			if udidudid then
				assistU = false
			--	RegisterAssist(udidudid)
				Sleep(500,600)
				Log('辅助验证成功')
				local path = "http://api.wj.ink"
				local userName = selects.注册辅助平台账号
				local userPwd = selects.注册辅助平台密码
				while true do
					local code, res_headers, body = http.post(path.."/onFinish.action",5,{},"userName="..userName.."&userPwd="..userPwd.."&script=8f6834b7cfed4438a79932662f776647&uid="..udidudid)
					if code == 200 then
						body = json.decode(body)
						sys.toast("辅助成功")
						Log('辅助成功')
						break
						else
						sys.toast("网络异常,请检查本机网络状态正常,或联系客服人员!!!")
					end
				end
				return true 
			else
				sys.toast("辅助失败")
				Log('辅助失败')
				return true 
			end
		end
	
	
end