dever 3 years ago
parent
commit
37142f1e64
6 changed files with 793 additions and 18 deletions
  1. 49 5
      config/wechat.php
  2. 150 0
      database/subscribe.php
  3. 168 0
      database/subscribe_log.php
  4. 150 0
      database/subscribe_send.php
  5. 30 13
      src/Msg.php
  6. 246 0
      src/Subscribe.php

+ 49 - 5
config/wechat.php

@@ -28,15 +28,20 @@ $config['send_msg'] = array
 	'method' => 'post',
 	'json' => true,
 	'url' => 'https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?',
+	'url' => 'https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send?',
 	'param' => array
 	(
 		'access_token' => 'token',
 		'touser' => 'touser',
-		'template_id' => 'template_id',
-		'page' => 'page',
-		'form_id' => 'form_id',
-		'data' => 'data',
-		'emphasis_keyword' => 'emphasis_keyword',
+		'weapp_template_msg' => array
+		(
+			'template_id' => 'template_id',
+			'page' => 'page',
+			'form_id' => 'form_id',
+			'data' => 'data',
+			'emphasis_keyword' => 'emphasis_keyword',
+		),
+		
 	),
 	//针对一些返回的名称,做转换
 	'response' => array
@@ -64,6 +69,45 @@ $config['get_msg'] = array
 	),
 );
 
+$config['send_subscribe'] = array
+(
+	'name' => '发送订阅消息',
+	'method' => 'post',
+	'json' => true,
+	'url' => 'https://api.weixin.qq.com/cgi-bin/message/subscribe/send?',
+	'param' => array
+	(
+		'access_token' => 'token',
+		'touser' => 'touser',
+		'template_id' => 'template_id',
+		'page' => 'page',
+		'data' => 'data',
+		'miniprogram_state' => 'miniprogram_state',
+	),
+	//针对一些返回的名称,做转换
+	'response' => array
+	(
+		
+	),
+);
+
+$config['get_subscribe'] = array
+(
+	'name' => '获取帐号下已存在的订阅消息模板列表',
+	'method' => 'post',
+	'json' => true,
+	'url' => 'https://api.weixin.qq.com/wxaapi/newtmpl/gettemplate?',
+	'param' => array
+	(
+		'access_token' => 'token',
+	),
+	//针对一些返回的名称,做转换
+	'response' => array
+	(
+		
+	),
+);
+
 $config['total_base'] = array
 (
 	'name' => '概况趋势',

+ 150 - 0
database/subscribe.php

@@ -0,0 +1,150 @@
+<?php
+$type = array
+(
+	//1 => '保留',
+	2 => '一次性订阅',
+	3 => '长期订阅',
+);
+return array
+(
+	# 表名
+	'name' => 'subscribe',
+	# 显示给用户看的名称
+	'lang' => '订阅消息列表',
+	'order' => 89,
+	'desc' => Dever::markdown('发送模板消息接口:'.Dever::url("wechat_applet/subscribe.send").'
+
+		key:消息key
+		project_id:项目id
+		touser:用户openid
+		page:页面路径
+		data:内容
+		miniprogram_state:developer为开发版;trial为体验版;formal为正式版;默认为正式版
+	'),
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> 'ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'search'	=> 'order',
+			//'list'		=> true,
+		),
+
+		'project_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '项目ID',
+			'default' 	=> '',
+			'desc' 		=> '请输入项目',
+			'match' 	=> 'is_numeric',
+			'list'		=> true,
+		),
+		
+		'name'		=> array
+		(
+			'type' 		=> 'varchar-120',
+			'name' 		=> '模板标题',
+			'default' 	=> '',
+			'desc' 		=> '模板标题',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'list'		=> true,
+		),
+
+		'type'		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '订阅类型',
+			'default' 	=> '1',
+			'desc' 		=> '订阅类型',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'select',
+			'option'	=> $type,
+			'list'		=> true,
+		),
+
+		'key'		=> array
+		(
+			'type' 		=> 'varchar-20',
+			'name' 		=> '模板消息key-通过key值搜索数据',
+			'default' 	=> '',
+			'desc' 		=> '模板消息key-通过key值搜索数据',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'list'		=> true,
+			'edit'		=> true,
+		),
+
+		'template_id'		=> array
+		(
+			'type' 		=> 'varchar-120',
+			'name' 		=> '模板id',
+			'default' 	=> '',
+			'desc' 		=> '模板id',
+			'match' 	=> 'is_string',
+			//'update'	=> 'text',
+			//'list'		=> true,
+		),
+
+		'content'		=> array
+		(
+			'type' 		=> 'varchar-600',
+			'name' 		=> '模板内容',
+			'default' 	=> '',
+			'desc' 		=> '模板内容',
+			'match' 	=> 'option',
+			//'update'	=> 'textarea',
+			'list'		=> true,
+		),
+
+		'example'		=> array
+		(
+			'type' 		=> 'varchar-600',
+			'name' 		=> '模板样例',
+			'default' 	=> '',
+			'desc' 		=> '模板样例',
+			'match' 	=> 'option',
+			//'update'	=> 'textarea',
+			'list'		=> true,
+			'modal'		=> '点此查看',
+		),
+		
+		'state'		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '状态',
+			'default' 	=> '1',
+			'desc' 		=> '请选择状态',
+			'match' 	=> 'is_numeric',
+		),
+		
+		'cdate'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '更新时间',
+			'match' 	=> array('is_numeric', time()),
+			'desc' 		=> '',
+			'default' 	=> '',
+			'list'		=> 'date("Y-m-d H:i:s", {cdate})',
+		),
+	),
+
+	//'top' => Dever::config('base', 'wechat_applet')->top,
+
+	'manage' => array
+	(
+		//'delete' => false,
+		'insert' => false,
+		//'edit' => false,
+
+		'button' => array
+		(
+			'同步模板' => 'wechat_applet/msg.sync',
+		),
+	),
+);

+ 168 - 0
database/subscribe_log.php

@@ -0,0 +1,168 @@
+<?php
+
+$status = array
+(
+	1 => '发送中',
+	2 => '发送成功',
+	3 => '发送失败',
+);
+
+$type = array
+(
+	'developer' => '开发版',
+	'trial' => '体验版',
+	'formal' => '正式版',
+);
+
+return array
+(
+	# 表名
+	'name' => 'subscribe_log',
+	# 显示给用户看的名称
+	'lang' => '订阅消息日志',
+	'order' => 77,
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> 'ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'search'	=> 'order',
+			'list'		=> true,
+		),
+
+		'project_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '项目',
+			'default' 	=> '',
+			'desc' 		=> '请输入项目',
+			'match' 	=> 'is_numeric',
+			'list'		=> true,
+		),
+		
+		'subscribe_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '消息id',
+			'default' 	=> '',
+			'desc' 		=> '消息id',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'text',
+			'list'		=> 'Dever::load("wechat_applet/subscribe-one#name", {subscribe_id})',
+		),
+
+		'touser'		=> array
+		(
+			'type' 		=> 'varchar-120',
+			'name' 		=> '接收者',
+			'default' 	=> '',
+			'desc' 		=> '接收者',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'list'		=> true,
+		),
+
+		'path'		=> array
+		(
+			'type' 		=> 'varchar-200',
+			'name' 		=> '跳转页面',
+			'default' 	=> '',
+			'desc' 		=> '跳转页面',
+			'match' 	=> 'option',
+			'update'	=> 'textarea',
+			//'list'		=> true,
+		),
+
+		'data'		=> array
+		(
+			'type' 		=> 'text-255',
+			'name' 		=> '模板内容',
+			'default' 	=> '',
+			'desc' 		=> '模板内容',
+			'match' 	=> 'option',
+			'update'	=> 'textarea',
+			//'list'		=> true,
+		),
+
+		'miniprogram_state'		=> array
+		(
+			'type' 		=> 'varchar-300',
+			'name' 		=> '跳转小程序类型',
+			'default' 	=> 'formal',
+			'desc' 		=> '跳转小程序类型',
+			'match' 	=> 'option',
+			'update'	=> 'select',
+			'search'	=> 'select',
+			'option'	=> $type,
+			'list'		=> true,
+		),
+
+		'num'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '发送次数',
+			'default' 	=> '0',
+			'desc' 		=> '发送次数',
+			'match' 	=> 'option',
+			//'search'	=> 'order',
+			'list'		=> true,
+		),
+
+		'result'		=> array
+		(
+			'type' 		=> 'text-255',
+			'name' 		=> '微信返回信息',
+			'default' 	=> '',
+			'desc' 		=> '微信返回信息',
+			'match' 	=> 'option',
+			'update'	=> 'textarea',
+			'list'		=> true,
+			'modal'		=> '查看详情',
+		),
+
+		'status'		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '状态',
+			'default' 	=> '1',
+			'desc' 		=> '状态',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'select',
+			'option'	=> $status,
+			'list'		=> true,
+		),
+		
+		'state'		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '状态',
+			'default' 	=> '1',
+			'desc' 		=> '请选择状态',
+			'match' 	=> 'is_numeric',
+		),
+		
+		'cdate'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '更新时间',
+			'match' 	=> array('is_numeric', time()),
+			'desc' 		=> '',
+			'default' 	=> '',
+			'list'		=> 'date("Y-m-d H:i:s", {cdate})',
+		),
+	),
+
+	//'top' => Dever::config('base', 'wechat_applet')->top,
+
+	'manage' => array
+	(
+		'delete' => false,
+		'insert' => false,
+		'edit' => false,
+	),
+);

+ 150 - 0
database/subscribe_send.php

@@ -0,0 +1,150 @@
+<?php
+
+$project = function()
+{
+	$array = array();
+	$info = Dever::load('token/project-state', array('option_type' => 3));
+	if($info)
+	{
+		$array += $info;
+	}
+	return $array;
+};
+$type = array
+(
+	'developer' => '开发版',
+	'trial' => '体验版',
+	'formal' => '正式版',
+);
+return array
+(
+	# 表名
+	'name' => 'subscribe_send',
+	# 显示给用户看的名称
+	'lang' => '发送订阅消息',
+	'order' => 79,
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> 'ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'search'	=> 'order',
+			//'list'		=> true,
+		),
+
+		'project_id'		=> array
+		(
+			'type' 		=> 'varchar-300',
+			'name' 		=> '选择项目',
+			'default' 	=> '',
+			'desc' 		=> '选择项目',
+			'match' 	=> 'is_numeric',
+			'list'		=> true,
+			'update'	=> 'checkbox',
+			'option'	=> $project,
+		),
+
+		'key'		=> array
+		(
+			'type' 		=> 'varchar-20',
+			'name' 		=> '模板消息key',
+			'default' 	=> '',
+			'desc' 		=> '模板消息key',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'list'		=> true,
+			'edit'		=> true,
+		),
+
+		'page'		=> array
+		(
+			'type' 		=> 'varchar-200',
+			'name' 		=> '页面路径',
+			'default' 	=> 'pages/index/index',
+			'desc' 		=> '页面路径',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'list'		=> true,
+		),
+
+		'miniprogram_state'		=> array
+		(
+			'type' 		=> 'varchar-300',
+			'name' 		=> '跳转小程序类型',
+			'default' 	=> 'formal',
+			'desc' 		=> '跳转小程序类型',
+			'match' 	=> 'option',
+			'update'	=> 'select',
+			'search'	=> 'select',
+			'option'	=> $type,
+			'list'		=> true,
+		),
+
+		'content'		=> array
+		(
+			'type' 		=> 'text-255',
+			'name' 		=> '模板内容',
+			'default' 	=> '',
+			'desc' 		=> '请输入内容',
+			'match' 	=> 'is_string',
+			'update'	=> array
+			(
+				array
+				(
+					'col'		=> 'key',
+					'name' 		=> '标识',
+					'default' 	=> '',
+					'desc' 		=> '请输入标识',
+					'match' 	=> 'is_string',
+					'update'	=> 'text',
+				),
+				array
+				(
+					'col' 		=> 'value',
+					'name' 		=> '内容值',
+					'default' 	=> '',
+					'desc' 		=> '内容值',
+					'match' 	=> 'is_string',
+					'update'	=> 'textarea',
+				),
+			),
+		),
+
+		'state'		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '状态',
+			'default' 	=> '1',
+			'desc' 		=> '请选择状态',
+			'match' 	=> 'is_numeric',
+		),
+		
+		'cdate'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '更新时间',
+			'match' 	=> array('is_numeric', time()),
+			'desc' 		=> '',
+			'default' 	=> '',
+			'list'		=> 'date("Y-m-d H:i:s", {cdate})',
+		),
+	),
+
+	//'top' => Dever::config('base', 'wechat_applet')->top,
+
+	'manage' => array
+	(
+		//'delete' => false,
+		//'insert' => false,
+		//'edit' => false,
+		'list_button' => array
+		(
+			'oper' => array('立刻发送', '"wechat_applet/subscribe.submit?id={id}"'),
+		),
+	),
+);

+ 30 - 13
src/Msg.php

@@ -157,19 +157,36 @@ class Msg
 			# 获取所有拥有formid的openid,并去重
 			$list = Dever::db('wechat_applet/msg_form')->getAllGroupByOpenid(array('option_project_id' => $project_id));
 			if ($list) {
-				Dever::import('queue');
-				foreach ($list as $k => $v) {
-					if ($v['form_id']) {
-						$param = array();
-						$param['key'] = $key;
-						$param['project_id'] = $project_id;
-						$param['touser'] = $v['openid'];
-						$param['page'] = $page;
-						$param['data'] = $data;
-						$param['form_id'] = $v['form_id'];
-						$param['emphasis_keyword'] = $emphasis_keyword;
-						Dever::db('wechat_applet/msg_form')->delete($v['id']);
-						Dever::push($param);
+				if (Dever::project('queue')) {
+					Dever::import('queue');
+					foreach ($list as $k => $v) {
+						if ($v['form_id']) {
+							$param = array();
+							$param['key'] = $key;
+							$param['project_id'] = $project_id;
+							$param['touser'] = $v['openid'];
+							$param['page'] = $page;
+							$param['data'] = $data;
+							$param['form_id'] = $v['form_id'];
+							$param['emphasis_keyword'] = $emphasis_keyword;
+							Dever::db('wechat_applet/msg_form')->delete($v['id']);
+							Dever::push($param);
+						}
+					}
+				} else {
+					foreach ($list as $k => $v) {
+						if ($v['form_id']) {
+							$param = array();
+							$param['key'] = $key;
+							$param['project_id'] = $project_id;
+							$param['touser'] = $v['openid'];
+							$param['page'] = $page;
+							$param['data'] = $data;
+							$param['form_id'] = $v['form_id'];
+							$param['emphasis_keyword'] = $emphasis_keyword;
+							Dever::db('wechat_applet/msg_form')->delete($v['id']);
+							$this->sendOne($param['key'], $param['project_id'], $param['touser'], $param['page'], $param['data'], $param['form_id'], $daparamta['emphasis_keyword']);
+						}
 					}
 				}
 			}

+ 246 - 0
src/Subscribe.php

@@ -0,0 +1,246 @@
+<?php
+/*
+|--------------------------------------------------------------------------
+| 订阅消息
+|--------------------------------------------------------------------------
+*/
+namespace Wechat_applet\Src;
+
+use Dever;
+use Token\Lib\Wechat;
+use Token\Lib\Core;
+
+class Subscribe
+{
+	# 发送模板消息
+	public function test()
+	{
+		$page = 'pages/index/index';
+		$data = array
+        (
+            'keyword1' => array
+            (
+                'value' => '测试活动',
+            ),
+            'keyword2' => array
+            (
+                'value' => date('Y-m-d H:i:s'),
+            ),
+            'keyword3' => array
+            (
+                'value' => '欢迎参加',
+            ),
+        );
+
+        $data = json_encode($data);
+		//Dever::setInput('touser', 'oIZ895bO9a_TT_ouYCQLPFMod57c');
+		
+		//Dever::setInput('touser', 'oIZ895bO9a_TT_ouYCQLPFMod57c');
+		Dever::setInput('page', $page);
+		Dever::setInput('data', $data);
+		//Dever::setInput('form_id', '1526295575657');
+		Dever::setInput('key', 'act');
+		Dever::setInput('project_id', '1');
+
+		$type = Dever::input('type', 1);
+		if ($type == 1) {
+			return $this->send();
+		} else {
+			return $this->sendMul();
+		}
+	}
+
+	# 发送单条模板消息
+	public function send()
+	{
+		$key = Dever::input('key');
+		$project_id = Dever::input('project_id');
+		$touser = Dever::input('touser');
+		$page = Dever::input('page');
+		//$data = json_encode(Dever::input('data'));
+		$data = Dever::input('data');
+		$miniprogram_state = Dever::input('type', 'formal');
+		$this->sendOne($key, $project_id, $touser, $page, $data, $miniprogram_state);
+
+		return 'ok';
+	}
+
+	# 发送单条模板消息
+	public function sendOne($key, $project_id, $touser, $path, $data, $miniprogram_state = '', $state = false)
+	{
+		if ($project_id > 0 && $key && $touser && $path && $data) {
+			$info = Dever::db('wechat_applet/subscribe')->one(array('option_key' => $key, 'option_project_id' => $project_id));
+			if ($info) {
+				$update = array();
+				$update['project_id'] = $info['project_id'];
+				$update['subscribe_id'] = $info['id'];
+				$update['touser'] = $touser;
+				$update['path'] = $path;
+				$update['data'] = $data;
+				$update['status'] = 1;
+				$update['miniprogram_state'] = $miniprogram_state;
+
+				$where = array();
+				$where['option_subscribe_id'] = $info['id'];
+				$where['option_touser'] = $update['touser'];
+				$where['option_path'] = $update['path'];
+
+				$id = Dever::upinto('wechat_applet/subscribe_log', $where, $update);
+
+				Core::run($info['project_id'], 'send_subscribe', 'subscribe.sendAction', 'subscribe.sendLog', 'wechat_applet', $id, $state);
+			}
+		}
+	}
+
+	public function submit()
+	{
+		# 立刻发送
+		$id = Dever::input('id');
+		if ($id > 0) {
+			$info = Dever::db('wechat_applet/subscribe_send')->one($id);
+			if ($info) {
+				$project = explode(',', $info['project_id']);
+				Dever::setInput('key', $info['key']);
+				Dever::setInput('page', $info['page']);
+				Dever::setInput('miniprogram_state', $info['miniprogram_state']);
+				$send = $this->getData($info['content']);
+
+				foreach ($project as $k => $v) {
+					Dever::setInput('project_id', $v);
+					$this->sendMul();
+				}
+			}
+		}
+		Dever::alert('提交成功,请到订阅消息日志中查看发送记录');
+		return;
+	}
+
+	# 解析data
+	public function getData($data = false)
+	{
+		$send = Dever::input('data');
+		if (!$send && $data) {
+			$send = array();
+			$data = json_decode(base64_decode($data), true);
+			if ($data) {
+				foreach ($data as $k => $v) {
+					$send[$v['key']]['value'] = $v['value'];
+				}
+				$send = json_encode($send, JSON_UNESCAPED_UNICODE);
+				Dever::setInput('data', $send);
+			}
+		}
+		
+		return $send;
+	}
+
+	# 发送多条模板消息 入队
+	public function sendMul()
+	{
+		$key = Dever::input('key');
+		$project_id = Dever::input('project_id');
+		$page = Dever::input('page');
+		$data = Dever::input('data');
+		$miniprogram_state = Dever::input('miniprogram_state');
+		if ($project_id > 0 && $key && $page && $data) {
+			$param = array();
+			$param['key'] = $key;
+			$param['project_id'] = $project_id;
+			$param['touser'] = $v['openid'];
+			$param['page'] = $page;
+			$param['data'] = $data;
+			$param['miniprogram_state'] = $miniprogram_state;
+			if (Dever::project('queue')) {
+				Dever::import('queue');
+				Dever::push($param);
+			} else {
+				$this->sendOne($param['key'], $param['project_id'], $param['touser'], $param['page'], $param['data'], $param['miniprogram_state']);
+			}
+		}
+
+		return 'ok';
+	}
+
+	# 发送多条模板消息 出队 每小时执行一次
+	public function cron()
+	{
+		Dever::import('queue');
+		$state = true;//同步发送
+		$total = 100;
+		$num = 0;
+		while($num < $total) {
+			$data = Dever::pop();
+			if ($data) {
+				$num++;
+				$state = true;
+				$this->sendOne($data['key'], $data['project_id'], $data['touser'], $data['page'], $data['data'], $data['miniprogram_state'], $state);
+			} else {
+				$num = $total+1;
+			}
+		}
+		return 'ok';
+	}
+
+	public function sendAction($id)
+	{
+		$info = Dever::db('wechat_applet/subscribe_log')->one($id);
+		if ($info) {
+			$info['page'] = $info['path'];
+			$msg = Dever::db('wechat_applet/subscribe')->one($info['subscribe_id']);
+			$info['template_id'] = $msg['template_id'];
+			if ($info['data']) {
+				$info['data'] = json_decode($info['data'], true);
+			}
+			return $info;
+		} else {
+			die;
+		}
+	}
+
+	public function sendLog($project_id, $data, $id = false)
+	{
+		$info = Dever::db('wechat_applet/subscribe_log')->one($id);
+		if ($info) {
+			$update['where_id'] = $info['id'];
+			$update['result'] = json_encode($data);
+			if ($data['errmsg'] == 'ok') {
+				$update['status'] = 2;
+			} else {
+				$update['status'] = 3;
+			}
+			$update['num'] = $info['num'] + 1;
+			Dever::db('wechat_applet/subscribe_log')->update($update);
+		}
+	}
+
+
+	# 同步微信消息模板到本地
+	public function sync()
+	{
+		$project = Dever::db('token/project')->state(array('option_type' => 3));
+		if ($project) {
+			foreach ($project as $k => $v) {
+				Core::run($v['id'], 'get_subscribe', '', 'subscribe.load', 'wechat_applet');
+			}
+		}
+
+		return 'ok';
+	}
+
+	public function load($project_id, $data, $param = false)
+	{
+		if (isset($data['data']) && $data['data']) {
+			foreach ($data['list'] as $k => $v) {
+				$update = array();
+				$update['project_id'] = $project_id;
+				$update['template_id'] = $v['priTmplId'];
+				$update['content'] = $v['content'];
+				$update['name'] = $v['title'];
+				$update['example'] = $v['example'];
+				$update['type'] = $v['type'];
+				$id = Dever::upinto('wechat_applet/subscribe', array('option_project_id' => $project_id, 'option_template_id' => $v['template_id']), $update);
+			}
+		}
+		return array();
+	}
+}